• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / cli / 18718316541

22 Oct 2025 01:46PM UTC coverage: 54.587% (-0.02%) from 54.604%
18718316541

Pull #4334

github

web-flow
Merge 7159aa5e9 into 8d34a0f7e
Pull Request #4334: feat: command to analyze table read/write I/O patterns

14 of 24 new or added lines in 2 files covered. (58.33%)

7 existing lines in 2 files now uncovered.

6403 of 11730 relevant lines covered (54.59%)

6.1 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.0
/internal/inspect/traffic_profile/traffic_profile.go
1
package traffic_profile
2

3
import (
4
        "context"
5
        _ "embed"
6
        "fmt"
7

8
        "github.com/go-errors/errors"
9
        "github.com/jackc/pgconn"
10
        "github.com/jackc/pgx/v4"
11
        "github.com/spf13/afero"
12
        "github.com/supabase/cli/internal/utils"
13
        "github.com/supabase/cli/pkg/pgxv5"
14
)
15

16
//go:embed traffic_profile.sql
17
var TrafficProfileQuery string
18

19
type Result struct {
20
        Schemaname     string
21
        Table_name     string
22
        Blocks_read    int64
23
        Write_tuples   int64
24
        Blocks_write   float64
25
        Activity_ratio string
26
}
27

28
func Run(ctx context.Context, config pgconn.Config, fsys afero.Fs, options ...func(*pgx.ConnConfig)) error {
1✔
29
        conn, err := utils.ConnectByConfig(ctx, config, options...)
1✔
30
        if err != nil {
1✔
NEW
31
                return err
×
NEW
32
        }
×
33
        defer conn.Close(context.Background())
1✔
34
        rows, err := conn.Query(ctx, TrafficProfileQuery)
1✔
35
        if err != nil {
1✔
NEW
36
                return errors.Errorf("failed to query rows: %w", err)
×
NEW
37
        }
×
38
        result, err := pgxv5.CollectRows[Result](rows)
1✔
39
        if err != nil {
1✔
NEW
40
                return err
×
NEW
41
        }
×
42

43
        table := "|Schema|Table|Blocks Read|Write Tuples|Blocks Write|Activity Ratio|\n|-|-|-|-|-|-|\n"
1✔
44
        for _, r := range result {
2✔
45
                table += fmt.Sprintf("|`%s`|`%s`|`%d`|`%d`|`%.1f`|`%s`|\n",
1✔
46
                        r.Schemaname, r.Table_name, r.Blocks_read, r.Write_tuples, r.Blocks_write, r.Activity_ratio)
1✔
47
        }
1✔
48
        return utils.RenderTable(table)
1✔
49
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc