Re: [HACKERS] Group by, count, order by and limit

2003-02-18 Thread Bruno Wolff III
On Tue, Feb 18, 2003 at 10:26:46 +0600, Anuradha Ratnaweera <[EMAIL PROTECTED]> wrote: > > My 3rd attempt to post ... > > Consider this query on a large table with lots of different IDs: > > SELECT id FROM my_table GROUP BY id ORDER BY count(id) LIMIT 10; > > It has an index on id. Obvio

Re: [HACKERS] Group by, count, order by and limit

2003-02-18 Thread Christoph Haller
> > Consider this query on a large table with lots of different IDs: > > SELECT id FROM my_table GROUP BY id ORDER BY count(id) LIMIT 10; > > It has an index on id. Obviously, the index helps to evaluate count(id) > for a given value of id, but count()s for all the `id's should be > evaluated,