Showing posts with label how to know which object. Show all posts
Showing posts with label how to know which object. Show all posts

Thursday 20 February 2014

Know object/table size in Odoo database

Table Size in Odoo


Every time after backup we check how much space needed. Its necessary, but its normal if we have lots of space, but when database size continuously increase then we need to check which table/object increase your database size so fast.

So, in PostgreSQL if we want to see which table/object increase your database size then by following sql query, you can easily know which object consume how much.

[Query ]:
SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
AND C.relkind <> 'i'
AND nspname !~ '^pg_toast'
ORDER BY pg_total_relation_size(C.oid) DESC
LIMIT 100;


..Enjoy..