| From: | Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com> |
|---|---|
| To: | Mike Ivanov <mike(at)thelinguist(dot)com> |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Poor select count(*) performance |
| Date: | 2009-02-24 01:56:00 |
| Message-ID: | dcc563d10902231756t66feaa14jfac9ae3e81fc43c1@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Mon, Feb 23, 2009 at 6:44 PM, Mike Ivanov <mike(at)thelinguist(dot)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?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Greg Smith | 2009-02-24 02:42:42 | Re: High cpu usage after many inserts |
| Previous Message | Mike Ivanov | 2009-02-24 01:44:05 | Poor select count(*) performance |