Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2b26a69

Browse files
committed
Make UniqueRelInfo a node
d3d55ce changed RelOptInfo.unique_for_rels from the list of Relid sets to the list of UniqueRelInfo's. But it didn't make UniqueRelInfo a node. This commit makes UniqueRelInfo a node. Also this commit revises some comments related to RelOptInfo.unique_for_rels. Reported-by: Tom Lane Discussion: https://postgr.es/m/flat/1189851.1698340331%40sss.pgh.pa.us
1 parent 74604a3 commit 2b26a69

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

src/backend/optimizer/plan/analyzejoins.c

-14
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,6 @@
3434
#include "optimizer/tlist.h"
3535
#include "utils/lsyscache.h"
3636

37-
/*
38-
* UniqueRelInfo caches a fact that a relation is unique when being joined
39-
* to other relation(s) specified by outerrelids.
40-
* 'extra_clauses' contains additional clauses from a baserestrictinfo list that
41-
* were used to prove uniqueness. We cache it for the SJ checking procedure: SJ
42-
* can be removed if the outer relation contains strictly the same set of
43-
* clauses.
44-
*/
45-
typedef struct UniqueRelInfo
46-
{
47-
Relids outerrelids;
48-
List *extra_clauses;
49-
} UniqueRelInfo;
50-
5137
/*
5238
* The context for replace_varno_walker() containing source and target relids.
5339
*/

src/include/nodes/pathnodes.h

+27-2
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ typedef struct PartitionSchemeData *PartitionScheme;
719719
* populate these fields, for base rels; but someday they might be used for
720720
* join rels too:
721721
*
722-
* unique_for_rels - list of Relid sets, each one being a set of other
722+
* unique_for_rels - list of UniqueRelInfo, each one being a set of other
723723
* rels for which this one has been proven unique
724724
* non_unique_for_rels - list of Relid sets, each one being a set of
725725
* other rels for which we have tried and failed to prove
@@ -952,7 +952,7 @@ typedef struct RelOptInfo
952952
/*
953953
* cache space for remembering if we have proven this relation unique
954954
*/
955-
/* known unique for these other relid set(s) */
955+
/* known unique for these other relid set(s) given in UniqueRelInfo(s) */
956956
List *unique_for_rels;
957957
/* known not unique for these set(s) */
958958
List *non_unique_for_rels;
@@ -3391,4 +3391,29 @@ typedef struct AggTransInfo
33913391
bool initValueIsNull;
33923392
} AggTransInfo;
33933393

3394+
/*
3395+
* UniqueRelInfo caches a fact that a relation is unique when being joined
3396+
* to other relation(s).
3397+
*/
3398+
typedef struct UniqueRelInfo
3399+
{
3400+
pg_node_attr(no_copy_equal, no_read, no_query_jumble)
3401+
3402+
NodeTag type;
3403+
3404+
/*
3405+
* The relation in consideration is unique when being joined with this set
3406+
* of other relation(s).
3407+
*/
3408+
Relids outerrelids;
3409+
3410+
/*
3411+
* Additional clauses from a baserestrictinfo list that were used to prove
3412+
* the uniqueness. We cache it for the self-join checking procedure: a
3413+
* self-join can be removed if the outer relation contains strictly the
3414+
* same set of clauses.
3415+
*/
3416+
List *extra_clauses;
3417+
} UniqueRelInfo;
3418+
33943419
#endif /* PATHNODES_H */

0 commit comments

Comments
 (0)