How to quickly parse postgres database
3 answers
The functions you want are here:
http://www.postgresql.org/docs/current/interactive/functions-admin.html#FUNCTIONS-ADMIN-DBSIZE
A quick query to find the top 20 tables in terms of space usage might look like this:
SELECT oid::regclass, pg_size_pretty(pg_total_relation_size(oid))
FROM pg_class
WHERE relkind = 'r'
ORDER BY pg_total_relation_size(oid) DESC
LIMIT 20;
+4
source to share
Interest Ask. I think you can query information using psql. Here are some pointers.
http://securfox.wordpress.com/2009/09/02/how-to-find-the-postgresql-database-size/ and http://heatware.net/databases/find-postgresql-database-size-using -sql-select / .
Hope this helps.
Thank you, Shankar
+1
source to share