PostgreSQL : Get total pages of an object

SELECT pg_relation_size(<object_id>, 'main')/8192);
The pg_relation_size gives the disk space occupied by the object. Since each page is of 8kB, the pg_relation_size size is divided by 8192 to give the page count.

No comments:

Post a Comment