On Mon, Nov 23, 2026 at 7:28 PM wenhui qiu <[email protected]> wrote: >> Since all relations in remove_self_joins_one_group() share the same >> reloid (and have !rte->inh), would it be worth checking >> rel_supports_distinctness() once in remove_self_joins_one_group() so that >> we can skip the whole group early if the table has no suitable unique >> index?
Thanks for the review! Good point. I've added the check at the top of remove_self_joins_one_group(), so that we skip the whole group if the relation has no usable unique index. >> Perhaps we can drop otherjoinquals and simplify split_selfjoin_quals() to >> just return the list of self-join quals (similar to >> get_shared_restrictions())? Agreed. Nothing uses the other quals anymore, so I've changed the function to return just the self-join quals, and renamed it to get_selfjoin_quals(). Attached is the updated patch. - Richard
v2-0001-Simplify-the-uniqueness-proof-for-self-join-elimi.patch
Description: Binary data
