Re: [GENERAL] How to optimize select count(*)..group by?

2005-07-28 Thread Greg Stark
Bryan Field-Elliot <[EMAIL PROTECTED]> writes: > 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

Re: [GENERAL] How to optimize select count(*)..group by?

2005-07-28 Thread Scott Marlowe
On Thu, 2005-07-28 at 11:19, 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

Re: [GENERAL] How to optimize select count(*)..group by?

2005-07-28 Thread Bricklen Anderson
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 ver

Re: [GENERAL] How to optimize select count(*)..group by?

2005-07-28 Thread Richard Huxton
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 (a

Re: [GENERAL] How to optimize select count(*)..group by?

2005-07-28 Thread David Fetter
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 > "exp

[GENERAL] How to optimize select count(*)..group by?

2005-07-28 Thread Bryan Field-Elliot
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 slowl