Re: [PERFORM] Unexpected sequence scan

2012-05-04 Thread Dan Fairs
Hi Tom, Kevin, >> 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 unreason

Re: [PERFORM] Unexpected sequence scan

2012-05-04 Thread Tom Lane
Dan Fairs 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

Re: [PERFORM] Unexpected sequence scan

2012-05-04 Thread Kevin Grittner
Dan Fairs wrote: > 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. Looking at the actual row counts compared to run time, it appears that the active portion of your data set is heavily cached

[PERFORM] Unexpected sequence scan

2012-05-04 Thread Dan Fairs
Hi, I'm fairly new to PostgreSQL query tuning, so please forgive me if I've overlooked something obvious. 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 plan