Skip site navigation (1) Skip section navigation (2)

Re: Unexpected sequence scan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dan Fairs <dan(dot)fairs(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Unexpected sequence scan
Date: 2012-05-04 14:43:19
Message-ID: 5025.1336142599@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-performance
Dan Fairs <dan(dot)fairs(at)gmail(dot)com> writes:

> I have a query which is running slowly, and the query plan shows an
unexpected sequence scan where I'd have expected the planner to use an
index. Setting enable_seqscan=off causes the planner to use the index as
expected.

That hashjoin plan doesn't look at all unreasonable to me.  The fact
that it actually comes out a lot slower than the nestloop with inner
indexscan suggests that you must be running with the large table
completely cached in RAM.  If that's the normal state of affairs for your
database, you should consider decreasing the random_page_cost setting
so that the planner will plan appropriately.

			regards, tom lane

In response to

Responses

pgsql-performance by date

Next:From: Dan FairsDate: 2012-05-04 14:56:12
Subject: Re: Unexpected sequence scan
Previous:From: Kevin GrittnerDate: 2012-05-04 14:40:32
Subject: Re: Unexpected sequence scan

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group