Re: indexes across joins not used for count - Mailing list pgsql-novice

From Jeff Davis
Subject Re: indexes across joins not used for count
Date
Msg-id 1350757282.14401.11.camel@jdavis
Whole thread Raw
In response to indexes across joins not used for count  (Jeremy Wells <jemmyw@gmail.com>)
Responses Re: indexes across joins not used for count
List pgsql-novice
On Tue, 2012-10-16 at 16:08 +1300, Jeremy Wells wrote:
> I'm running a query to do a count with two joins in it. I've added
> indexes to the tables for the join columns, but the explain of the query
> doesn't seem to be using the indexes:

Can you post the output of EXPLAIN ANALYZE? Did you do an ANALYZE of the
tables already?

You can often force an index scan by doing:

   SET enable_seqscan=false;

So also try setting that, and run EXPLAIN ANALYZE again, and see if it
uses the indexes, and if so, if it's faster.

Regards,
    Jeff Davis



pgsql-novice by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Guidance needed to be a postgreSQL DBA
Next
From: Jeremy Wells
Date:
Subject: Re: indexes across joins not used for count