Re: [RFC] speed up count(*)

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: [RFC] speed up count(*)
Дата
Msg-id CA+TgmoYrwq7uTufUMhFC6+f9hwUaSvxQ1gTa=NAxpAcoah7_Kw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [RFC] speed up count(*)  (Joe Conway <mail@joeconway.com>)
Ответы Re: [RFC] speed up count(*)  (Joe Conway <mail@joeconway.com>)
Список pgsql-hackers
On Thu, Oct 21, 2021 at 9:09 AM Joe Conway <mail@joeconway.com> wrote:
> I think you are exactly correct. People seem to understand that with a
> predicate it is harder, but they expect
>
>   select count(*) from foo;
>
> to be nearly instantaneous, and they don't really need it to be exact.
> The stock answer for that has been to do
>
>   select reltuples from pg_class
>   where relname = 'foo';
>
> But that is unsatisfying because the problem is often with some
> benchmark or another that cannot be changed.

I would also expect it to almost always give the wrong answer.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



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

Предыдущее
От: "Bossart, Nathan"
Дата:
Сообщение: Re: parallelizing the archiver
Следующее
От: David Christensen
Дата:
Сообщение: Re: CREATE ROLE IF NOT EXISTS