Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions central/globaldb/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ SELECT TABLE_NAME
, SUM(c.reltuples) OVER (partition BY parent) AS row_estimate
, SUM(pg_total_relation_size(c.oid)) OVER (partition BY parent) AS total_bytes
, SUM(pg_indexes_size(c.oid)) OVER (partition BY parent) AS index_bytes
, SUM(pg_total_relation_size(reltoastrelid)) OVER (partition BY parent) AS toast_bytes
, SUM(COALESCE(pg_total_relation_size(reltoastrelid), 0)) OVER (partition BY parent) AS toast_bytes
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious if it should be this instead:

COALESCE(SUM(pg_total_relation_size(reltoastrelid)) OVER (partition BY parent), 0) AS toast_bytes

I haven't tested it, but I'm curious if they both give the same results or if one is more efficient than the other

, parent
FROM (
SELECT pg_class.oid
Expand Down Expand Up @@ -131,7 +131,7 @@ func collectPostgresStats(ctx context.Context, db *pgxpool.Pool) {
tableSize int
)
if err := row.Scan(&tableName, &rowEstimate, &totalSize, &indexSize, &toastSize, &tableSize); err != nil {
log.Errorf("error scanning row: %v", err)
log.Errorf("error scanning row for table %s: %v", tableName, err)
return
}

Expand Down