Re: Support run-time partition pruning for hash join

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Support run-time partition pruning for hash join
Date: 2024-09-06 07:18:57
Message-ID: CAMbWs49j+jtkDn2pZwtNFmW9Kt-PWVQJvkbLYne0e6r=_==FXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 6, 2024 at 9:22 AM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> Maybe instead of inventing a very pessimistic part prune Hash Join, it
> might be better to make the above work without the LATERAL + OFFSET 0
> by creating the parameterized paths Seq Scan paths. That's going to be
> an immense help when the non-partitioned relation just has a small
> number of rows, which I think your costing favoured anyway.
>
> What do you think?

This approach seems promising. It reminds me of the discussion about
pushing join clauses into a seqscan [1]. But I think there are two
problems that we need to address to make it work.

* Currently, the costing code does not take run-time pruning into
consideration. How should we calculate the costs of the parameterized
paths on partitioned tables?

* This approach generates additional paths at the scan level, which
may not be easily compared with regular scan paths. As a result, we
might need to retain these paths at every level of the join tree. I'm
afraid this could lead to a significant increase in planning time in
some cases. We need to find a way to avoid regressions in planning
time.

[1] https://postgr.es/m/3478841.1724878067@sss.pgh.pa.us

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2024-09-06 07:50:30 Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN
Previous Message Ashutosh Bapat 2024-09-06 07:07:55 Re: Add memory/disk usage for WindowAgg nodes in EXPLAIN