On Tuesday 18 Feb 2003 9:56 am, you 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. 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, so sort() will take most of the time.
First, what does explain analyze say
Second, wild shot, how much difference does it make with different sort_mem
settings?
Shridhar