Re: How can I know the disk space used by a table?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How can I know the disk space used by a table?
Дата
Msg-id 2394.997195875@sss.pgh.pa.us
обсуждение исходный текст
Ответ на How can I know the disk space used by a table?  ("Andrea Aime" <aaime@comune.modena.it>)
Список pgsql-general
"Andrea Aime" <aaime@comune.modena.it> writes:
> is there any way to have an estimate of the disk space used by a table?

(1) VACUUM foo;

(2) SELECT relpages * 8 FROM pg_class WHERE relname = 'foo';

This gives you the actual file size in kilobytes.  (The magic number 8
assumes you are using the default BLCKSZ of 8K, else adjust to match.)

You need the VACUUM step to be sure the relpages field is up to date;
it's not updated during normal operations.

            regards, tom lane

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

Предыдущее
От: Daniel Åkerud
Дата:
Сообщение: Transactions and timestamps
Следующее
От: "Joe Conway"
Дата:
Сообщение: Re: Still wondering about random numbers...