I have come across the need to totally disable PostgreSQL query optimization just so that I can measure the effectiveness of applying QO (I want to see a before and after). I have come across this topic How to disable all optimizations of PostgreSQL from 2014 which basically says it's not possible. I wonder if anything has changed since then? I would really like to see a bad plan vs good plan scenario with a dramatic difference.
Asked
Active
Viewed 448 times
1 Answers
3
You can't execute a query without a plan, and the optimizer is what comes up with the plan. There is no "default" plan which would exist in the absence of the optimizer.
You turn all the enable_*
parameters to off, except for enable_seqscan
and enable_nestloop
.
Or you could set join_collapse_limit
and from_collapse_limit
both 1, that would severely constrain what the optimizer can do.

jjanes
- 37,812
- 5
- 27
- 34