Re: Pathify RHS unique-ification for semijoin planning

2025-05-22 Thread wenhui qiu
On Thu, 22 May 2025 at 17:28, Andy Fan wrote: > Richard Guo writes: > > Hi, > > > However, in the case of sort-based implementation, > > this function pays no attention to the subpath's pathkeys or the > > pathkeys of the resulting output. > > Good finding! > > > > > In addition to this specific

Re: Pathify RHS unique-ification for semijoin planning

2025-05-22 Thread Andy Fan
Richard Guo writes: Hi, > However, in the case of sort-based implementation, > this function pays no attention to the subpath's pathkeys or the > pathkeys of the resulting output. Good finding! > > In addition to this specific issue, it seems to me that there are > other potential issues in cr

Pathify RHS unique-ification for semijoin planning

2025-05-22 Thread Richard Guo
I came across a query where the plan includes some unnecessary Sort nodes. Here's an example that shows the issue. create table t(a int, b int); insert into t select i%100, i from generate_series(1,1)i; create index on t(a); vacuum analyze t; set enable_hashagg to off; explain (costs off) s