pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Track a Bitmapset of non-pruned partitions in RelOptInfo
Date: Mon, 02 Aug 2021 23:47:59 +0000
Message-ID: <E1mAhf5-0006Qp-U3@gemulon.postgresql.org> (raw)

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/475dbd0b718de8ac44da144f934651b959e3b705

Modified Files
--------------
src/backend/nodes/outfuncs.c          |  1 +
src/backend/optimizer/path/joinrels.c |  1 +
src/backend/optimizer/plan/planner.c  | 31 +++++++++++++++++++------------
src/backend/optimizer/util/inherit.c  |  2 +-
src/backend/optimizer/util/relnode.c  |  3 +++
src/backend/partitioning/partprune.c  |  7 +++----
src/include/nodes/pathnodes.h         |  3 +++
7 files changed, 31 insertions(+), 17 deletions(-)



Message-ID: <E1mAhf5-0006Qp-U3@gemulon.postgresql.org>
Permalink:  ../E1mAhf5-0006Qp-U3@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1mAhf5-0006Qp-U3@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: drowley@postgresql.org
  Subject: Re: pgsql: Track a Bitmapset of non-pruned partitions in RelOptInfo
  In-Reply-To: <E1mAhf5-0006Qp-U3@gemulon.postgresql.org>
  References: <E1mAhf5-0006Qp-U3@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox