Re: Postgres Database size

Поиск
Список
Период
Сортировка
От Naz Gassiep
Тема Re: Postgres Database size
Дата
Msg-id 45FE3803.6010107@mira.net
обсуждение исходный текст
Ответ на Re: Postgres Database size  (Reece Hart <reece@harts.net>)
Список pgsql-general
I have been looking for such a function. Having Just upgraded to 8.2,
this function is a very welcome addition to my arsenal of tools.
Many thanks!
- Naz.

Reece Hart wrote:

  On Sun, 2007-03-18 at 00:40 +0530, Mageshwaran wrote:


    how to find the size of a particular database in postgres...



The old way was to use du or similar. Recent versions (I believe >=8.1,
but check the release notes to be sure) provide several useful functions
for this:
 pg_column_size
 pg_database_size
 pg_relation_size
 pg_size_pretty
 pg_tablespace_size
 pg_total_relation_size


For example:

rkh@csb-dev=> select datname,pg_size_pretty(pg_database_size(oid)) from
pg_database ;
           datname           | pg_size_pretty
-----------------------------+----------------
 postgres                    | 3905 kB
 csb                         | 113 GB
 template0                   | 3840 kB
 csb-dev                     | 124 GB
 csb-dev-snapshot-2007-03-08 | 123 GB
 csb_02_02_2007              | 121 GB
 template1                   | 3840 kB

В списке pgsql-general по дате отправления:

Предыдущее
От: Reid Thompson
Дата:
Сообщение: Re: Shell script to determine if PostgreSQL is accepting connections?
Следующее
От: Alban Hertroys
Дата:
Сообщение: Re: planning issue