From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Support parameterized TidPaths.
Date: Sun, 30 Dec 2018 20:40:16 +0000
Message-ID: <E1gdhse-00040M-JJ@gemulon.postgresql.org> (raw)
Support parameterized TidPaths.
Up to now we've not worried much about joins where the join key is a
relation's CTID column, reasoning that storing a table's CTIDs in some
other table would be pretty useless. However, there are use-cases for
this sort of query involving self-joins, so that argument doesn't really
hold water.
This patch allows generating plans for joins on CTID that use a nestloop
with inner TidScan, similar to what we might do with an index on the join
column. This is the most efficient way to join when the outer side of
the nestloop is expected to yield relatively few rows.
This change requires upgrading tidpath.c and the generated TidPaths
to work with RestrictInfos instead of bare qual clauses, but that's
long-postponed technical debt anyway.
Discussion: https://postgr.es/m/17443.1545435266@sss.pgh.pa.us
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/b5415e3c2187ab304390524f5ae66b4bd2c58279
Modified Files
--------------
src/backend/optimizer/path/costsize.c | 9 +-
src/backend/optimizer/path/tidpath.c | 394 ++++++++++++++++++++++----------
src/backend/optimizer/plan/createplan.c | 67 +++++-
src/backend/optimizer/util/pathnode.c | 6 +-
src/include/nodes/plannodes.h | 3 +-
src/include/nodes/relation.h | 4 +-
src/test/regress/expected/tidscan.out | 55 +++++
src/test/regress/sql/tidscan.sql | 17 ++
8 files changed, 415 insertions(+), 140 deletions(-)
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: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Support parameterized TidPaths.
In-Reply-To: <E1gdhse-00040M-JJ@gemulon.postgresql.org>
References: <E1gdhse-00040M-JJ@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