Tuesday, 29 September 2020

PostgreSQL : Get total pages of an object

Below query can be used

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