1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-05 07:21:24 +03:00

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
This commit is contained in:
Tom Lane
2018-12-30 15:24:28 -05:00
parent 6f19a8c41f
commit b5415e3c21
8 changed files with 418 additions and 143 deletions

View File

@ -3715,12 +3715,8 @@ do { \
{
TidPath *tpath;
/*
* TidPath contains tidquals, which do not contain any
* external parameters per create_tidscan_path(). So don't
* bother to translate those.
*/
FLAT_COPY_PATH(tpath, path, TidPath);
ADJUST_CHILD_ATTRS(tpath->tidquals);
new_path = (Path *) tpath;
}
break;