Re: slow group by query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ellen Cyran <ellen(at)urban(dot)csuohio(dot)edu>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: slow group by query
Date: 2002-11-19 15:21:26
Message-ID: 20977.1037719286@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Ellen Cyran <ellen(at)urban(dot)csuohio(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Frank Bax 2002-11-19 15:44:07 Re: how can I improve the speed of this query
Previous Message Stephan Szabo 2002-11-19 15:04:15 Re: slow group by query