Thanks for the details! Indeed the versions with now()/current_date use the runtime pruning rather than planning time.
Iwasn't aware of the use of 'today' though - that could be useful in case we're sure statements won't be prepared.
Previously (v10/ partly v11) it was necessary to make sure that statements on partioned tables were never prepared,
becauserun-time pruning wasn't available - using a generic plan was almost always a bad option. Now in v12 it seems to
bea tradeoff between whether or not run-time pruning can occur. If pruning is possible at planning time it's probably
stillbetter not to prepare statements, whereas if run-time pruning has to occur, it's better to prepare them.
One unrelated thing I noticed (but I'm not sure if it's worth a separate email thread) is that the changed default of
jit=onin v12 doesn't work very well with a large number of partitions at run-time, for which a large number get
excludedat run-time. A query that has an estimated cost above jit_optimize_above_cost takes about 30 seconds to run
(fora table with 1000 partitions), because JIT is optimizing the full plan. Without JIT it's barely 20ms (+400ms
planning).I can give more details in a separate thread if it's deemed interesting.
Planning Time: 411.321 ms
JIT:
Functions: 5005
Options: Inlining false, Optimization true, Expressions true, Deforming true
Timing: Generation 721.472 ms, Inlining 0.000 ms, Optimization 16312.195 ms, Emission 12533.611 ms, Total 29567.278
ms
-Floris