Re: Pathify RHS unique-ification for semijoin planning

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andy Fan <zhihuifan1213(at)163(dot)com>, wenhui qiu <qiuwenhuifx(at)gmail(dot)com>
Subject: Re: Pathify RHS unique-ification for semijoin planning
Date: 2025-07-24 03:40:50
Message-ID: CAMbWs49O17zE0nge5a_CwYs+2NskMqnkNT-yro=kNqJ1eigCog@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 23, 2025 at 5:11 PM Álvaro Herrera <alvherre(at)kurilemu(dot)de> wrote:
> As a very trivial test on this patch, I ran the query in your opening
> email, both with and without the patch, scaling up the size of the table
> a little bit.

> This is a really nice improvement. I think we could find queries that
> are arbitrarily faster, by feeding enough tuples to the unnecessary Sort
> nodes.

Thank you for testing this patch!

In addition to eliminating unnecessary sort nodes, this patch also
allows us to exploit pre-sorted paths that aren't necessarily the
cheapest total during the unique-ification step. It also allows the
use of parallel plans for that step on large tables. I think we could
also find queries that become faster as a result of these improvements.

Thanks
Richard

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message shveta malik 2025-07-24 03:42:17 Re: Conflict detection for update_deleted in logical replication
Previous Message Tom Lane 2025-07-24 03:28:38 Re: Regression with large XML data input