Re: Improving count(*)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Improving count(*)
Дата
Msg-id 8720.1132263241@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Improving count(*)  (Simon Riggs <simon@2ndquadrant.com>)
Ответы Re: Improving count(*)  (Simon Riggs <simon@2ndquadrant.com>)
Список pgsql-hackers
Simon Riggs <simon@2ndquadrant.com> writes:
> Bearing in mind other RDBMS' approach is to count the number of rows in
> an index, their cost is probably about the same as scanning table
> blocks/10 very roughly - so the cost is far from zero for them.

Really?  The impression I get is that people who ask for this expect the
answer to be instantaneous, ie they think the system will maintain a
running net total for each table.  (In a non-MVCC system that isn't
necessarily an unreasonable thing to do.)

I really can't get excited about adding this level of complexity and
overhead to the system just to support COUNT(*)-with-no-WHERE slightly
better than we do now.

The triggers-and-deltas approach previously proposed seems considerably
more attractive to me, because (1) it's not invasive and (2) you only
have to pay the overhead on tables where you want it.
        regards, tom lane


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

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Improving count(*)
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Improving count(*)