From: | Richard Guo <guofenglinux(at)gmail(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | MemoizePath fails to work for partitionwise join |
Date: | 2022-12-05 10:43:15 |
Message-ID: | CAMbWs48GkNom272sfp0-WeD6_0HSR19BJ4H1c9ZKSfbVnJsvRg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I happened to notice that currently MemoizePath cannot be generated for
partitionwise join. I traced that and have found the problem. One
condition we need to meet to generate MemoizePath is that inner path's
ppi_clauses should have the form "outer op inner" or "inner op outer",
as checked by clause_sides_match_join in paraminfo_get_equal_hashops.
Note that when are at this check, the inner path has not got the chance
to be re-parameterized (that is done later in try_nestloop_path), so if
it is parameterized, it is parameterized by the topmost parent of the
outer rel, not the outer rel itself. Thus this check performed by
clause_sides_match_join could not succeed if we are joining two child
rels.
The fix is straightforward, just to use outerrel->top_parent if it is
not null and leave the reparameterization work to try_nestloop_path. In
addition, I believe when reparameterizing MemoizePath we need to adjust
its param_exprs too.
Attach the patch for fix.
Thanks
Richard
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Fix-MemoizePath-for-partitionwise-join.patch | application/octet-stream | 4.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2022-12-05 10:57:06 | Re: Avoid streaming the transaction which are skipped (in corner cases) |
Previous Message | John Naylor | 2022-12-05 10:18:24 | Re: slab allocator performance issues |