Re: PostgreSQL not using index for statement with group by

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Mark Starkman" <mark(dot)starkman(at)activant(dot)com>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: PostgreSQL not using index for statement with group by
Date: 2009-09-03 22:03:45
Message-ID: 4A9FF6F1020000250002AA99@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Mark Starkman <mark(dot)starkman(at)activant(dot)com> wrote:

> I'm not sure how to get it to return in
> reasonable amount of time.

Some more information could help.

What version of PostgreSQL is this?

Please give an overview of the hardware and OS.

Please show your postgresql.conf file, excluding comments.

Please run your query with EXPLAIN ANALYZE in front, so we can see the
execution plan, with cost estimates compared to actual information.
If the the plan indicates a sequential scan, and you think an indexed
scan may be faster, you might be able to coerce it into the indexed
plan for diagnostic purposes by running this on the connection before
an EXPLAIN ANALYZE run:

set enable_seqscan = off;

You don't want to leave it off, or try to use that in production, but
it might be useful in figuring out what's going on.

That might be enough to diagnose the issue.

-Kevin

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Otis 2009-09-03 22:51:03 Re: Seeking performance advice and explanation for high I/O on 8.3
Previous Message Ivan Voras 2009-09-03 21:56:38 Re: Seeking performance advice and explanation for high I/O on 8.3