Pierre-Frédéric Caillaud wrote: > The planner is smarter with GROUP BY than with DISTINCT, so you can > rewrite your query as the following, whihc will probaly use a > HashAggregate, and be a lot faster : > > SELECT service_id FROM five_min_stats_200408 GROUP BY service_id;
Pierre-Frédéric, thanks! Vast improvement - this is definitely acceptable. It did indeed use a seq scan followed by a hash aggregate. Total runtime: 76295.775 ms >> estat=> explain analyze select distinct(service_id) from >> five_min_stats_200408; QUERY PLAN >> ------------------------------------------------------------------------ >> ------------------------------------------------------------------------ >> >> Time: 1284213.359 ms -- Guy Rouillier ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])