| From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
|---|---|
| To: | Tomka Gergely <tomka(at)zeus(dot)gau(dot)hu> |
| Cc: | psql kezd? lista <pgsql-novice(at)postgresql(dot)org> |
| Subject: | Re: count(*) index |
| Date: | 2005-01-07 19:45:41 |
| Message-ID: | 20050107194541.GA15048@wolff.to |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
On Fri, Jan 07, 2005 at 19:22:56 +0100,
Tomka Gergely <tomka(at)zeus(dot)gau(dot)hu> wrote:
> Hi!
>
> Yes, i know, mvcc, and can't use indexes. And i know the workaround for
> max() and min(). Is there some workaround for count()?
>
> select count(*) from table where field=1;
>
> and field has a nice index. And this is slooooow.
If there are few records where field=1 then an index will be used.
You may get better performance maintaining a count table using triggers.
This may not work well of there are lots of concurrent updates.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jeffrey Melloy | 2005-01-07 21:02:35 | Re: Duplicating A Row |
| Previous Message | Julie Cottin | 2005-01-07 18:41:20 | Driver Information Please |