Re: Make COUNT(*) Faster?

Поиск
Список
Период
Сортировка
От Harald Fuchs
Тема Re: Make COUNT(*) Faster?
Дата
Msg-id puirziluoj.fsf@srv.protecting.net
обсуждение исходный текст
Ответ на Make COUNT(*) Faster?  (Varun Mehta <vmehta@apple.com>)
Ответы Re: Make COUNT(*) Faster?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
In article <758d5e7f05070808305c049aae@mail.gmail.com>,
Dawid Kuroczko <qnex42@gmail.com> writes:

> Use
> EXPLAIN SELECT * FROM yourcountedtable;

> Planner seems to track estimated statistics on-the-fly. :)

> You can even wrap EXPLAIN SELECT in a pgsql function if you
> need it.

Do you know how to do that?  A function "approx_count(tablename)"
would be really handy, but
 FOR row IN EXECUTE 'EXPLAIN SELECT * FROM ' || tbl LOOP

fails with the following message:
 ERROR:  cannot open non-SELECT query as cursor

> PS: And be aware that these are 'statistics'.  And the statement that there
> are lies, big lies and statistics is sometimes true even for PostgreSQL. ;-)

Does this mean that PostgreSQL believes only in statistics it has
faked itself?  ;-)



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

Предыдущее
От: Mischa Sandberg
Дата:
Сообщение: Re: getting back autonumber just inserted
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Make COUNT(*) Faster?