Re: Slow COUNT

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Slow COUNT
Дата
Msg-id 87wtikcq1r.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: Slow COUNT  (Tino Wildenhain <tino@wildenhain.de>)
Список pgsql-general
Tino Wildenhain <tino@wildenhain.de> writes:

> Am Sonntag, den 04.12.2005, 09:56 -0600 schrieb Bruno Wolff III:
> > On Sun, Dec 04, 2005 at 14:40:49 +0100,
> >
> > Assuming you are refering to max and min, this has already been done and is
> > in 8.1.
>
> I also mean sum, avg, ... and last not least count :-)

The naive implementation would mean serializing all table updates. In other
words only one person can update, insert, or delete at a time. Until that user
commits everybody else would be locked out of the table. You may as well be
using something like mysql then if that's acceptable.

The more sophisticated implementation would require customization to get
right. It requires a second table keeping track of deltas and a periodic job
aggregating those deltas. Which aggregates to put in it, how often to
aggregate them, and when to consult them instead of consulting the main table
would all be things that would require human intervention to get right.

It would be cool if there were a shrinkwrapped package, perhaps in contrib, to
do this with knobs for the user to play with instead of having to roll your
own. perhaps in contrib. But nobody's done a good enough version yet to
consider it.

--
greg

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

Предыдущее
От: vishal saberwal
Дата:
Сообщение: Selecting Large Object and TOAST
Следующее
От: Havasvölgyi Ottó
Дата:
Сообщение: Creating then dropping primary key constraint