As per PG official documentation on PREPARE, it is working as expected.
Use custom plan, but after 5th iteration compare cost of custom plan vs
generic plan and use the one with the less cost which is the generic
plan even though it is not as performant. Look at explain output to see
the diffs
Dag, if you ain't right! I can duplicate this on the ones I tested
with: PG v11 and v14. Gonna start diving into this myself...
Regards,
Michael Vitale
Mark Saward wrote on 2/23/2022 10:37 PM:
Hi,
I've experienced a situation where the planner seems to make a very
poor choice with a prep
Hi,
I've experienced a situation where the planner seems to make a very poor
choice with a prepared query after the first five executions. Looking
at the documentation, I think this happens because it switches from a
custom plan to a generic one, and doesn't make a good choice for the
gener