Re: [PERFORM] near identical queries have vastly different plans

2011-07-01 Thread Samuel Gendler
On Fri, Jul 1, 2011 at 3:46 PM, Tom Lane wrote: > Samuel Gendler writes: > > I've got 2 nearly identical queries that perform incredibly differently. > > The reason the slow query sucks is that the planner is estimating at > most one "s" row will match that complicated AND/OR condition, so it >

Re: [PERFORM] near identical queries have vastly different plans

2011-07-01 Thread Tom Lane
Samuel Gendler writes: > I've got 2 nearly identical queries that perform incredibly differently. The reason the slow query sucks is that the planner is estimating at most one "s" row will match that complicated AND/OR condition, so it goes for a nestloop. In the "fast" query there is another co

Re: [PERFORM] near identical queries have vastly different plans

2011-06-30 Thread Samuel Gendler
On Thu, Jun 30, 2011 at 1:53 AM, Samuel Gendler wrote: > If I could figure out either a query structure or an index structure which > will force the fast query plan, I'd be much happier. So that is what I am > looking for - an explanation of how I might convince the planner to always > use the fa

Re: [PERFORM] near identical queries have vastly different plans

2011-06-30 Thread Samuel Gendler
On Thu, Jun 30, 2011 at 1:53 AM, Samuel Gendler wrote: > If I could figure out either a query structure or an index structure which > will force the fast query plan, I'd be much happier. So that is what I am > looking for - an explanation of how I might convince the planner to always > use the fa