Re: [RFC] speed up count(*)

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: [RFC] speed up count(*)
Дата
Msg-id 0fb27154-ee62-9dc1-52a7-7e6d1b5b628d@joeconway.com
обсуждение исходный текст
Ответ на Re: [RFC] speed up count(*)  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: [RFC] speed up count(*)  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On 10/21/21 4:06 PM, Robert Haas wrote:
> 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.


That is a grossly overstated position. When I have looked, it is often 
not that terribly far off. And for many use cases that I have heard of 
at least, quite adequate.

Joe

-- 
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development



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

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