Skip to content

A platform for community discussion. Free, open, simple.

FEATURE: improve stats provided by rake db:stats

Sam Saffron4c6a0313f235
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index 61975adef62..afc470f4f4b 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -119,10 +119,12 @@ task 'db:stats' => 'environment' do
from pg_class
where oid = ('public.' || table_name)::regclass
) AS row_estimate,
- pg_size_pretty(pg_relation_size(quote_ident(table_name))) size
+ pg_size_pretty(pg_table_size(quote_ident(table_name))) table_size,
+ pg_size_pretty(pg_indexes_size(quote_ident(table_name))) index_size,
+ pg_size_pretty(pg_total_relation_size(quote_ident(table_name))) total_size
from information_schema.tables
where table_schema = 'public'
- order by pg_relation_size(quote_ident(table_name)) DESC
+ order by pg_total_relation_size(quote_ident(table_name)) DESC
SQL
puts