Re: Faster way of estimating database size

2018-06-15 Thread hubert depesz lubaczewski
On Fri, Jun 15, 2018 at 10:29:02AM +1000, Sam Saffron wrote: > SELECT pg_database.datname, pg_database_size(pg_database.datname) as > size FROM pg_database Consider reading and using approach shown in https://www.depesz.com/2018/02/17/which-schema-is-using-the-most-disk-space/ Best regards, depe

Re: Faster way of estimating database size

2018-06-15 Thread Fabio Pardi
Hi Sam, When behind a terminal I use \l+ to show the size of the databases, since it is handy to remember. It shows db size in a "pretty size". Timing both commands, i see that \l+ takes more or less the same time your query takes, but I think your query better fits the monitoring purpose. But

Faster way of estimating database size

2018-06-14 Thread Sam Saffron
Hi there, At the moment we are using: SELECT pg_database.datname, pg_database_size(pg_database.datname) as size FROM pg_database To gather size of databases for monitoring purposes in Prometheus. Our pg stat logging now shows this is our number one query cause we seem to be running it for some