HI Richard Guo
+/*
+ * Is given relation unique-ified?
+ *
+ * When the nominal jointype is JOIN_INNER, sjinfo->jointype is JOIN_SEMI, and
+ * the given rel is exactly the RHS of the semijoin, it indicates that the rel
+ * has been unique-ified.
+ */
+#define IS_UNIQUEIFIED_REL(rel, sjinfo, nominal_jointype) \
+ ((nominal_jointype) == JOIN_INNER && (sjinfo)->jointype == JOIN_SEMI && \
+ bms_equal((sjinfo)->syn_righthand, (rel)->relids))
+
static inline bool
is_uniqueified_rel(RelOptInfo *rel, SpecialJoinInfo *sjinfo, JoinType nominal_jointype)
{
return nominal_jointype == JOIN_INNER &&
sjinfo->jointype == JOIN_SEMI &&
bms_equal(sjinfo->syn_righthand, rel->relids);
}
Thanks
The v5 patch does not apply anymore, and here is a new rebase. There
are two main changes in v6:
* I choose to use the check I proposed earlier to determine whether a
relation has been unique-ified in costsize.c.
* Now that the only call to relation_has_unique_index_for() that
supplied an exprlist and oprlist has been removed, the loop handling
those lists is effectively dead code. 0002 removes that loop and
simplifies the function accordingly.
Thanks
Richard