Re: count(*) optimization

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: count(*) optimization
Дата
Msg-id 20030108162258.GA9033@wolff.to
обсуждение исходный текст
Ответ на count(*) optimization  ("Nikola Ivacic" <nikola@rs-pi.com>)
Список pgsql-sql
On Wed, Jan 08, 2003 at 17:04:40 +0100, Nikola Ivacic <nikola@rs-pi.com> wrote:
> Hi
> 
> I have trouble executing count(*) statement.
> On a large dataset it takes quite a while to return result.
> Is there any other way to get number of tupples in relation 
> or is the only way to optimize count() function to index it? 

Indexes won't help count.

If you retrieve counts a lot more than you do updates that will change their
value, then you may want to keep the counts in another table and use
triggers to keep them updated.


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

Предыдущее
От: "Nikola Ivacic"
Дата:
Сообщение: count(*) optimization
Следующее
От: "Nikola Ivacic"
Дата:
Сообщение: Re: count(*) optimization