Reporting table size to grafana I am trying to report partition metric to influxdb so that it can be visualised in grafana. I have partitioned my table using pg_partman. I want to report the size of the default table that is created by partman. This is the table where rows that don't fall into any of the existing partition tables are inserted into. 
I had 2 approaches in mind


select pg_size_pretty(pg_total_relation_size('&lt;default table name&gt;'))
select count(*) from &lt;default table name&gt;


If I am not wrong 'count(*)' does a full table scan? So it might slow down the query if there are lot of rows being inserted into the default table. 
I am not sure of pg_size_pretty(pg_total_relation_size ..) Is that constant time?
Also if there are other ways of doing this I would glad to know about them:)
pg_total_relation_size is definitely the way to go. It gets the size of the involved files from the file system, which is fast and not invasive.

If my monitoring system would regularly run SELECT count(*) on by big tables, I would kill it. It does a sequential scan and uses lots of resources.

For monitoring, I would not use pg_size_pretty. That is good for human readers, but automatic processing will be easier in bytes.