Re: Connection function

Поиск
Список
Период
Сортировка
От Joe Abbate
Тема Re: Connection function
Дата
Msg-id 4F6FEB90.5050608@freedomcircle.com
обсуждение исходный текст
Ответ на Re: Connection function  (Bill House <wch-tech@house-grp.net>)
Список psycopg
On 03/25/2012 09:00 PM, Bill House wrote:
> Regarding the statistics, I have since learned that the command:
>
>     select reltuples from pg_class where relname = 'your_file_name';
>
> Will give a record count.  I don't know how well it will keep up in a
> dynamic environment but it's a start.

reltuples "is only an estimate used by the planner."  See
http://www.postgresql.org/docs/9.1/static/catalog-pg-class.html

So if you want a more or less accurate count of rows at that given point
in time, then you should not depend on it.

As for the optimization of SELECT count(*) which Adrian had mentioned,
it's a 9.2 feature (as a result of index-only scans).  See
https://wiki.postgresql.org/wiki/Todo under Cache Usage.

Joe

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Connection function
Следующее
От: Federico Di Gregorio
Дата:
Сообщение: Re: Connection function