Re: How to identify all storage in a schema

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: How to identify all storage in a schema
Дата
Msg-id m964f9$bnt$1@ger.gmane.org
обсуждение исходный текст
Ответ на How to identify all storage in a schema  ("Campbell, Lance" <lance@illinois.edu>)
Ответы Re: How to identify all storage in a schema  ("Campbell, Lance" <lance@illinois.edu>)
Список pgsql-admin
Campbell, Lance schrieb am 14.01.2015 um 16:56:
> PostgreSQL 9.3
> Is there a query one can run that will give you a total storage for all objects (tables, indexes, etc) associated
witha particular schema? 
>
> Thanks for your assistance.

  select table_schema,
         sum(pg_total_relation_size(table_schema|| '.' ||table_name))
  from information_schema.tables
  where table_schema not in ('information_schema', 'pg_catalog')
  group by table_schema;

Of for just a single schema:

  select sum(pg_total_relation_size(table_schema|| '.' ||table_name))
  from information_schema.tables
  where table_schema = 'foobar';

There are other functions to retrieve the table or database sizes:

http://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT

Thomas


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

Предыдущее
От: "Campbell, Lance"
Дата:
Сообщение: How to identify all storage in a schema
Следующее
От: "Campbell, Lance"
Дата:
Сообщение: Re: How to identify all storage in a schema