Re: [PERFORM] Optimizer Not using the Right plan

2007-12-05 Thread galy lee
I think you may increase the row number that you want to limit, like LIMIT 50. LIMIT can change the cost of a plan dramatically. Looking in your SQL: where this_.fkaddressid= 6664161 order by this_.addressvaluationid desc limit 1; Planner may use either index1(this_.fkaddressid) or index2(

Re: [PERFORM] Optimizer Not using the Right plan

2007-12-04 Thread Pallav Kalva
Tom Lane wrote: Pallav Kalva <[EMAIL PROTECTED]> writes: why does it have different plans for different values Because the values occur different numbers of times (or so it thinks anyway). If the rowcount estimates are far from reality, perhaps increasing the statistics target woul

Re: [PERFORM] Optimizer Not using the Right plan

2007-12-04 Thread Tom Lane
Pallav Kalva <[EMAIL PROTECTED]> writes: >why does it have different plans for different values Because the values occur different numbers of times (or so it thinks anyway). If the rowcount estimates are far from reality, perhaps increasing the statistics target would help. However, since yo