Skip to content

Commit 96da877

Browse files
committed
bug: fix storage sizes
1 parent 2261850 commit 96da877

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/postgres/postgres.controller.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export class PostgresController {
430430
s.idx_tup_read,
431431
s.idx_tup_fetch,
432432
pg_relation_size(s.indexrelid) as index_size,
433-
pg_relation_size(s.relid) as table_size
433+
pg_table_size(s.relid) as table_size
434434
FROM pg_stat_user_indexes s
435435
ORDER BY s.idx_scan DESC
436436
`);
@@ -860,11 +860,11 @@ export class PostgresController {
860860
const summaryResult = await this.postgres.query<SummaryRow>(`
861861
SELECT
862862
SUM(pg_total_relation_size(quote_ident(schemaname)||'.'||quote_ident(relname))) as total_database_size,
863-
SUM(pg_relation_size(quote_ident(schemaname)||'.'||quote_ident(relname))) as total_table_size,
863+
SUM(pg_table_size(quote_ident(schemaname)||'.'||quote_ident(relname))) as total_table_size,
864864
SUM(pg_indexes_size(quote_ident(schemaname)||'.'||quote_ident(relname))) as total_indexes_size,
865865
SUM(CASE
866866
WHEN n_live_tup > 0
867-
THEN pg_relation_size(quote_ident(schemaname)||'.'||quote_ident(relname))::float / n_live_tup * n_dead_tup
867+
THEN pg_table_size(quote_ident(schemaname)||'.'||quote_ident(relname))::float / n_live_tup * n_dead_tup
868868
ELSE 0
869869
END) as estimated_reclaimable_space
870870
FROM pg_stat_user_tables
@@ -889,13 +889,13 @@ export class PostgresController {
889889
schemaname,
890890
relname as tablename,
891891
pg_total_relation_size(quote_ident(schemaname)||'.'||quote_ident(relname)) as total_size,
892-
pg_relation_size(quote_ident(schemaname)||'.'||quote_ident(relname)) as table_size,
892+
pg_table_size(quote_ident(schemaname)||'.'||quote_ident(relname)) as table_size,
893893
pg_indexes_size(quote_ident(schemaname)||'.'||quote_ident(relname)) as indexes_size,
894894
n_live_tup,
895895
n_dead_tup,
896896
CASE
897897
WHEN n_live_tup > 0
898-
THEN pg_relation_size(quote_ident(schemaname)||'.'||quote_ident(relname))::float / n_live_tup * n_dead_tup
898+
THEN pg_table_size(quote_ident(schemaname)||'.'||quote_ident(relname))::float / n_live_tup * n_dead_tup
899899
ELSE 0
900900
END as estimated_dead_tuple_bytes
901901
FROM pg_stat_user_tables

0 commit comments

Comments
 (0)