From 835bb975d8d11268582d9dbd26b0eeaa62b60632 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 29 Jun 2003 23:05:05 +0000 Subject: Restructure building of join relation targetlists so that a join plan node emits only those vars that are actually needed above it in the plan tree. (There were comments in the code suggesting that this was done at some point in the dim past, but for a long time we have just made join nodes emit everything that either input emitted.) Aside from being marginally more efficient, this fixes the problem noted by Peter Eisentraut where a join above an IN-implemented-as-join might fail, because the subplan targetlist constructed in the latter case didn't meet the expectation of including everything. Along the way, fix some places that were O(N^2) in the targetlist length. This is not all the trouble spots for wide queries by any means, but it's a step forward. --- src/backend/optimizer/util/pathnode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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 da9497d58a4..9e919079ccf 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.90 2003/06/15 22:51:45 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/util/pathnode.c,v 1.91 2003/06/29 23:05:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -581,7 +581,7 @@ create_unique_path(Query *root, RelOptInfo *rel, Path *subpath) else { pathnode->rows = rel->rows; - numCols = length(rel->targetlist); /* second-best estimate */ + numCols = length(FastListValue(&rel->reltargetlist)); } /* -- cgit v1.2.3