Ellen Cyran <[EMAIL PROTECTED]> writes: > Is there any way to make this query faster? I have indexes on year, > msa_code, and sic. I've also tried it with > an index on the combined group by columns. I've made both sort_mem and > shared_buffers bigger, but still this query > takes 40 seconds when I select 4 msa_codes and 7 minutes when I select 40 > msa_codes.
Hm, have you vacuum analyzed lately? Those cost estimates seem awfully low for a query that is taking 40 sec. Also, if you're using 7.2 (which you should be ;-)) then showing EXPLAIN ANALYZE results would be more useful than plain EXPLAIN. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly