Обсуждение: pg_database_size

Поиск
Список
Период
Сортировка

pg_database_size

От
sangeetha
Дата:
SELECT pg_database_size('DB1')  takes 60ms for 7948 kB size DB. Is there any
way to reduce the time taken or any other ways to find data base size?

Thanks and Regards,
S.Sangeetha



--
View this message in context: http://postgresql.nabble.com/pg-database-size-tp5906449.html
Sent from the PostgreSQL - performance mailing list archive at Nabble.com.


Re: pg_database_size

От
Venkata Balaji N
Дата:

On Sat, Jun 4, 2016 at 5:35 PM, sangeetha <tune2sangee@gmail.com> wrote:
SELECT pg_database_size('DB1')  takes 60ms for 7948 kB size DB. Is there any
way to reduce the time taken or any other ways to find data base size?

What is the version of PostgreSQL you are using ?

You can execute the command "\l+" which will list all the databases and their sizes. 

Or you can execute "\l+ <database-name>".

Regards,
Venkata B N

Re: pg_database_size

От
Jim Nasby
Дата:
On 6/4/16 3:10 AM, Venkata Balaji N wrote:
>
> On Sat, Jun 4, 2016 at 5:35 PM, sangeetha <tune2sangee@gmail.com
> <mailto:tune2sangee@gmail.com>> wrote:
>
>     SELECT pg_database_size('DB1')  takes 60ms for 7948 kB size DB. Is
>     there any
>     way to reduce the time taken or any other ways to find data base size?
>
>
> What is the version of PostgreSQL you are using ?
>
> You can execute the command "\l+" which will list all the databases and
> their sizes.
>
> Or you can execute "\l+ <database-name>".

Depending on your needs, you could also take the sum of
pg_class.relpages and multiply that by BLKSZ.
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)   mobile: 512-569-9461