mirror of
https://github.com/postgres/postgres.git
synced 2025-09-05 02:22:28 +03:00
Restructure planning of nestloop inner indexscans so that the set of usable
joinclauses is determined accurately for each join. Formerly, the code only considered joinclauses that used all of the rels from the outer side of the join; thus for example FROM (a CROSS JOIN b) JOIN c ON (c.f1 = a.x AND c.f2 = b.y) could not exploit a two-column index on c(f1,f2), since neither of the qual clauses would be in the joininfo list it looked in. The new code does this correctly, and also is able to eliminate redundant clauses, thus fixing the problem noted 24-Oct-02 by Hans-Jürgen Schönig.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.41 2002/06/20 20:29:29 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/list.c,v 1.42 2002/11/24 21:52:13 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* XXX a few of the following functions are duplicated to handle
|
||||
@@ -372,6 +372,46 @@ set_unioni(List *l1, List *l2)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generate the intersection of two lists,
|
||||
* ie, all members of both l1 and l2.
|
||||
*
|
||||
* NOTE: if there are duplicates in l1 they will still be duplicate in the
|
||||
* result; but duplicates in l2 are discarded.
|
||||
*
|
||||
* The result is a fresh List, but it points to the same member nodes
|
||||
* as were in the inputs.
|
||||
*/
|
||||
#ifdef NOT_USED
|
||||
List *
|
||||
set_intersect(List *l1, List *l2)
|
||||
{
|
||||
List *retval = NIL;
|
||||
List *i;
|
||||
|
||||
foreach(i, l1)
|
||||
{
|
||||
if (member(lfirst(i), l2))
|
||||
retval = lappend(retval, lfirst(i));
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
List *
|
||||
set_intersecti(List *l1, List *l2)
|
||||
{
|
||||
List *retval = NIL;
|
||||
List *i;
|
||||
|
||||
foreach(i, l1)
|
||||
{
|
||||
if (intMember(lfirsti(i), l2))
|
||||
retval = lappendi(retval, lfirsti(i));
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
* member()
|
||||
* nondestructive, returns t iff l1 is a member of the list l2
|
||||
|
Reference in New Issue
Block a user