Re: Poor select count(*) performance

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Poor select count(*) performance
Дата
Msg-id dcc563d10902231756t66feaa14jfac9ae3e81fc43c1@mail.gmail.com
обсуждение исходный текст
Ответ на Poor select count(*) performance  (Mike Ivanov <mike@thelinguist.com>)
Список pgsql-general
On Mon, Feb 23, 2009 at 6:44 PM, Mike Ivanov <mike@thelinguist.com> wrote:
> Hi there,
>
> I'm sorry for a stupid question but I'm really stuck.
>
> A query:
>
> SELECT COUNT(*) FROM "lingq_card" WHERE "lingq_card"."context_id" = ...;
>
> An hour ago it took 8 seconds, one minute ago the same query took just only
> 7 milliseconds.

The two common causes are caching and changing query plans.

How many rows did it have to hit, did it use an index, which index did
it use, and were the rows it needed already in the pg shared_buffers
OR the OS / kernel file system cache when retrieved?

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

Предыдущее
От: Mike Ivanov
Дата:
Сообщение: Poor select count(*) performance
Следующее
От: Greg Smith
Дата:
Сообщение: Re: High cpu usage after many inserts