From 72a63afdee8d88f6537968bf62bca877ea34baa3 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Mon, 8 Dec 2025 16:16:03 -0700 Subject: [PATCH] size of db instead of table --- cmd/pg-fill/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/pg-fill/main.go b/cmd/pg-fill/main.go index 204e697..7fc1b79 100644 --- a/cmd/pg-fill/main.go +++ b/cmd/pg-fill/main.go @@ -7,6 +7,7 @@ import ( "fmt" "log" "os" + "path" "time" "pg/src/with" @@ -30,8 +31,10 @@ func run(ctx context.Context) error { return with.PSQL(ctx, *c, func(pg *sql.DB) error { presently := func() int { + dbname := path.Base(*c) + var n2 int - if row := pg.QueryRowContext(ctx, `SELECT pg_total_relation_size('fill_with_data')/1024/1024`); row.Err() != nil { + if row := pg.QueryRowContext(ctx, `SELECT pg_database_size('`+dbname+`')/1024/1024`); row.Err() != nil { return 0 } else if err := row.Scan(&n2); err != nil { return 0