@carllee1983/dbcli 1.6.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ -- ---
2
+ -- name: Table sizes (postgres)
3
+ -- description: Total / table / index size with estimated row count.
4
+ -- engine: postgres
5
+ -- ---
6
+ SELECT schemaname AS schema,
7
+ tablename AS table,
8
+ pg_size_pretty(pg_total_relation_size(schemaname||'.'||tablename)) AS total_size,
9
+ pg_size_pretty(pg_relation_size(schemaname||'.'||tablename)) AS table_size,
10
+ pg_size_pretty(pg_indexes_size(schemaname||'.'||tablename)) AS index_size,
11
+ n_live_tup AS estimated_rows
12
+ FROM pg_stat_user_tables
13
+ ORDER BY pg_total_relation_size(schemaname||'.'||tablename) DESC;