Re: slow group by query - Mailing list pgsql-sql

From Tom Lane
Subject Re: slow group by query
Date
Msg-id 20977.1037719286@sss.pgh.pa.us
Whole thread Raw
In response to slow group by query  (Ellen Cyran <ellen@urban.csuohio.edu>)
Responses Re: slow group by query  (Ellen Cyran <ellen@urban.csuohio.edu>)
List pgsql-sql
Ellen Cyran <ellen@urban.csuohio.edu> 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


pgsql-sql by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: slow group by query
Next
From: Frank Bax
Date:
Subject: Re: how can I improve the speed of this query