Determining dead/unused space in a table?

Поиск
Список
Период
Сортировка
От David Spadea
Тема Determining dead/unused space in a table?
Дата
Msg-id 4ae0cb070910180411j49488d53h2f7044fdbe078102@mail.gmail.com
обсуждение исходный текст
Ответы Re: Determining dead/unused space in a table?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi all,

I'm looking to do some reporting on tablespace usage, and wanted to be able to determine how much of the space a table physically occupies is actually in use.

1. I know I can get n_live_tup and n_dead_tup from pg_stat_all_tables, but I don't think that really answers the question entirely. After a vacuum, my understanding is that the n_dead_tup will go to zero, but the physical table size will not have decreased. The pages simply remain available for future use. How do I determine the amount of space which is not occupied by live/dead tuples?

2. Is there a way to calculate the amount of space occupied by dead tuples, or even to calculate the space used by live tuples so I can subtract it from pg_relation_size()? I don't think it's valid to multiply n_dead_tup by page size, as multiple tuples could be on a given page.

Thanks for your help!
Dave

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

Предыдущее
От: Thom Brown
Дата:
Сообщение: Re: How ad an increasing index to a query result?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Determining dead/unused space in a table?