| От | Tom Lane |
|---|---|
| Тема | Re: Obtaining the exact size of the database. |
| Дата | |
| Msg-id | 25289.1277048081@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Obtaining the exact size of the database. (Dave Crooke <dcrooke@gmail.com>) |
| Список | pgsql-performance |
Dave Crooke <dcrooke@gmail.com> writes:
> 4. If you're trying to figure out the net size of the table, i.e. how much
> free space is inside the table files for reuse by PG, then you need the
> pg_stat_tuple function ... this is built in to PG 8.4, and a plug-in
> activated by a script for PG 8.3, don't know if it exists in 8.1 or not.
> Like SELECT COUNT(*) this requires a full table scan.
I think what the OP actually wants is the number of live rows, so plain
old SELECT COUNT(*) would do it. If that's too slow, a good alternative
is to ANALYZE the table and then look at its pg_class.reltuples entry
--- of course that will only be an approximate count.
regards, tom lane
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера