pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ellen Cyran <ellen@urban.csuohio.edu>
Cc: pgsql-sql@postgresql.org
Subject: Re: slow group by query
Date: Tue, 19 Nov 2002 10:21:26 -0500
Message-ID: <20977.1037719286@sss.pgh.pa.us> (raw)
In-Reply-To: <5.1.1.6.0.20021118124632.01b5dcf0@wolf.csuohio.edu>
References: <5.1.1.6.0.20021118124632.01b5dcf0@wolf.csuohio.edu>

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



view thread (8+ messages)  latest in thread

Message-ID: <20977.1037719286@sss.pgh.pa.us>
Permalink:  ../20977.1037719286@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20977.1037719286@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ellen@urban.csuohio.edu
  Subject: Re: slow group by query
  In-Reply-To: <20977.1037719286@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox