From: | Bricklen Anderson <BAnderson(at)PresiNET(dot)com> |
---|---|
To: | David Fetter <david(at)fetter(dot)org> |
Cc: | Bryan Field-Elliot <bryan_lists(at)netmeme(dot)org>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to optimize select count(*)..group by? |
Date: | 2005-07-28 17:02:43 |
Message-ID: | 42E90FB3.8090201@PresiNET.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
David Fetter wrote:
> On Thu, Jul 28, 2005 at 09:19:49AM -0700, Bryan Field-Elliot wrote:
>
>>We have this simple query:
>>
>>select status, count(*) from customer group by status;
>>
>>There is already a btree index on status, but, the customer table is
>>huge, and this query must be executed very frequently... an
>>"explain" on this query shows that it is quite costly (and we notice
>>it runs slowly)...
>>
>>Can someone recommend the best technique to optimize this? We can
>>create new indices, we can re-write this query.. But we'd rather not
>>add new tables or columns if possible (not just to solve this
>>problem).
>
>
> You're pretty much stuck with either writing triggers that modify a
> cache table or having your performance the way it is now.
>
> Cheers,
> D
How about the new bitmap index? I wonder if that'll result in better performance
for that type of query?
--
_______________________________
This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in
error, please advise me (by return e-mail or otherwise) immediately.
_______________________________
From | Date | Subject | |
---|---|---|---|
Next Message | Jaime Casanova | 2005-07-28 17:19:04 | Fwd: Trigger ad mutli database |
Previous Message | SCassidy | 2005-07-28 17:00:27 | Re: Perl DBI and postgres |