Try to force a unique plan, like that: SELECT field, field2 ... FROM table1 WHERE field3 = 'xxx' AND field4 = 'yyy' AND field5 = 'zzz' so, in that example, I need the planner to use my field4 index, but the planner insists to use the field5, so I rewrite the query like this: SELECT field, field2 ... FROM table1 WHERE trim(field3) = 'xxx' AND field4 = 'yyy' AND trim(field5) = 'zzz' I didn´t give any option to the planner, so I get what plan I want. Waldomiro Tom Lane escreveu: "Michal J. Kubski" <michal.kub...@cdt.pl> writes:[ function that creates a bunch of temporary tables and immediately joins them ]It'd probably be a good idea to insert an ANALYZE on the temp tables after you fill them. The way you've got this set up, there is no chance of auto-analyze correcting that oversight for you, so the planner will be planning the join "blind" without any stats. Good results would only come by pure luck.regards, tom lane |
- [PERFORM] query planning different in plpgsql? Michal J . Kubski
- Re: [PERFORM] query planning different in plpgsq... Scott Mead
- Re: [PERFORM] query planning different in pl... Grzegorz JaĆkiewicz
- Re: [PERFORM] query planning different i... Michal J . Kubski
- Re: [PERFORM] query planning differe... Merlin Moncure
- Re: [PERFORM] query planning di... Michal J . Kubski
- Re: [PERFORM] query plannin... Tom Lane
- Re: [PERFORM] query pla... Waldomiro
- Re: [PERFORM] query pla... Michal J. Kubski
- Re: [PERFORM] query planning di... Michal J. Kubski
- Re: [PERFORM] query planning different in pl... Tom Lane
- Re: [PERFORM] query planning different in plpgsq... Scott Carey