"Albertson, Chris" <CAlbertson@primeadvantage.com> writes:
> What can I do to speed up queries like the following
> select count(*) from ttt group by xxx;
Not much at the user level, I'm afraid. Currently GROUP BY requires
a sort on the grouping column, and that's expensive for a big table.
There has been talk of reimplementing GROUP BY to avoid sorting
(instead maintaining a hash table with one entry for each distinct
value of the grouping column), and it might get done for 7.2 or so.
regards, tom lane