diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-06-10 15:22:25 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-06-10 15:22:32 -0400 |
commit | 73b7f48f78d27b1baf1a6541cbaae0fe6bd6186d (patch) | |
tree | c5e92bd3ae8eed8d8cf3519c10b12982d44bcfa8 /src/backend/nodes/outfuncs.c | |
parent | c83e2029909c5411ca11fd841851016f1f9810e6 (diff) | |
download | postgresql-73b7f48f78d27b1baf1a6541cbaae0fe6bd6186d.tar.gz postgresql-73b7f48f78d27b1baf1a6541cbaae0fe6bd6186d.zip |
Improve run-time partition pruning to handle any stable expression.
The initial coding of the run-time-pruning feature only coped with cases
where the partition key(s) are compared to Params. That is a bit silly;
we can allow it to work with any non-Var-containing stable expression, as
long as we take special care with expressions containing PARAM_EXEC Params.
The code is hardly any longer this way, and it's considerably clearer
(IMO at least). Per gripe from Pavel Stehule.
David Rowley, whacked around a bit by me
Discussion: https://postgr.es/m/CAFj8pRBjrufA3ocDm8o4LPGNye9Y+pm1b9kCwode4X04CULG3g@mail.gmail.com
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r-- | src/backend/nodes/outfuncs.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 610f9edaf5b..5895262c4a8 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -1742,6 +1742,7 @@ _outPartitionPruneInfo(StringInfo str, const PartitionPruneInfo *node) WRITE_NODE_FIELD(pruning_steps); WRITE_BITMAPSET_FIELD(present_parts); WRITE_INT_FIELD(nparts); + WRITE_INT_FIELD(nexprs); appendStringInfoString(str, " :subnode_map"); for (i = 0; i < node->nparts; i++) @@ -1751,8 +1752,13 @@ _outPartitionPruneInfo(StringInfo str, const PartitionPruneInfo *node) for (i = 0; i < node->nparts; i++) appendStringInfo(str, " %d", node->subpart_map[i]); - WRITE_BITMAPSET_FIELD(extparams); - WRITE_BITMAPSET_FIELD(execparams); + appendStringInfoString(str, " :hasexecparam"); + for (i = 0; i < node->nexprs; i++) + appendStringInfo(str, " %s", booltostr(node->hasexecparam[i])); + + WRITE_BOOL_FIELD(do_initial_prune); + WRITE_BOOL_FIELD(do_exec_prune); + WRITE_BITMAPSET_FIELD(execparamids); } /***************************************************************************** |