From b5415e3c2187ab304390524f5ae66b4bd2c58279 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 30 Dec 2018 15:24:28 -0500 Subject: 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 --- src/backend/optimizer/util/pathnode.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/backend/optimizer/util/pathnode.c') diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index d50d86b252f..81cc9cb31bf 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -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; -- cgit v1.2.3