diff options
author | David Rowley <drowley@postgresql.org> | 2021-08-03 11:47:24 +1200 |
---|---|---|
committer | David Rowley <drowley@postgresql.org> | 2021-08-03 11:47:24 +1200 |
commit | 475dbd0b718de8ac44da144f934651b959e3b705 (patch) | |
tree | df2a34ed2a93b6be5f603e9b5c789762a1d42a7e /src/include/nodes/pathnodes.h | |
parent | a5cb4f9829fbfd68655543d2d371a18a8eb43b84 (diff) | |
download | postgresql-475dbd0b718de8ac44da144f934651b959e3b705.tar.gz postgresql-475dbd0b718de8ac44da144f934651b959e3b705.zip |
Track a Bitmapset of non-pruned partitions in RelOptInfo
For partitioned tables with large numbers of partitions where queries are
able to prune all but a very small number of partitions, the time spent in
the planner looping over RelOptInfo.part_rels checking for non-NULL
RelOptInfos could become a large portion of the overall planning time.
Here we add a Bitmapset that records the non-pruned partitions. This
allows us to more efficiently skip the pruned partitions by looping over
the Bitmapset.
This will cause a very slight slow down in cases where no or not many
partitions could be pruned, however, those cases are already slow to plan
anyway and the overhead of looping over the Bitmapset would be
unmeasurable when compared with the other tasks such as path creation for
a large number of partitions.
Reviewed-by: Amit Langote, Zhihong Yu
Discussion: https://postgr.es/m/CAApHDvqnPx6JnUuPwaf5ao38zczrAb9mxt9gj4U1EKFfd4AqLA@mail.gmail.com
Diffstat (limited to 'src/include/nodes/pathnodes.h')
-rw-r--r-- | src/include/nodes/pathnodes.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h index e20c245f98a..ce7908c3267 100644 --- a/src/include/nodes/pathnodes.h +++ b/src/include/nodes/pathnodes.h @@ -762,6 +762,9 @@ typedef struct RelOptInfo List *partition_qual; /* Partition constraint, if not the root */ struct RelOptInfo **part_rels; /* Array of RelOptInfos of partitions, * stored in the same order as bounds */ + Bitmapset *live_parts; /* Bitmap with members acting as indexes into + * the part_rels[] array to indicate which + * partitions survived partition pruning. */ Relids all_partrels; /* Relids set of all partition relids */ List **partexprs; /* Non-nullable partition key expressions */ List **nullable_partexprs; /* Nullable partition key expressions */ |