pgsql: Support parameterized TidPaths.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Support parameterized TidPaths.
Дата
Msg-id E1gdhse-00040M-JJ@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Teach eval_const_expressions to constant-fold LEAST/GREATESTexp
Следующее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Change "checkpoint starting" message to use "wal"