Unknown why people have so little interest in this, AFAICS, there are more great usages of UniqueKey rather than the 'marking-distinct-as-noop'. The most exciting usage for me is it is helpful for JoinRel's pathkey.
Take an example of this: SELECT .. FROM t1 JOIN t2 ON t1.any_column = t2.uniquekey; SELECT .. FROM t1 LEFT JOIN t2 ON t1.any_column = t2.uniquekey; Suppose before the join, t1 has a pathkey X, t2 has PathKey y. Then (t1.X, t2.Y) is ordered as well for JoinRel(t1, t2). Then the pathkey of JoinRel(t1, t2) has a lot of usage again. Currently after the joining, only the outer join's pathkey is maintained. As for the extra planning cost of this, it looks like our current infrastructure can support it well since we know all the information when we generate the pathkey for the Join Path. -- Best Regards Andy Fan (https://www.aliyun.com/)