Re: Asymmetric partition-wise JOIN

From: "Andrey V(dot) Lepikhov" <a(dot)lepikhov(at)postgrespro(dot)ru>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, Aleksander Alekseev <afiskon(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, KaiGai Kohei <kaigai(at)heterodb(dot)com>
Subject: Re: Asymmetric partition-wise JOIN
Date: 2021-09-14 06:37:39
Message-ID: 2c9caede-55c0-2042-e421-dd0021f28837@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9/9/21 8:38 PM, Jaime Casanova wrote:
> On Thu, Sep 09, 2021 at 09:50:46AM +0000, Aleksander Alekseev wrote:
>> It looks like this patch needs to be updated. According to http://cfbot.cputube.org/ it applies but doesn't pass any tests. Changing the status to save time for reviewers.
>>
>> The new status of this patch is: Waiting on Author
>
> Just to give some more info to work on I found this patch made postgres
> crash with a segmentation fault.
>
> """
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0 0x0000556e37ef1b55 in bms_equal (a=0x7f6e37a9c5b0, b=0x7f6e37a9c5b0) at bitmapset.c:126
> 126 if (shorter->words[i] != longer->words[i])
> """
>
> attached are the query that triggers the crash and the backtrace.
>

Thank you for this good catch!
The problem was in the adjust_child_relids_multilevel routine. The
tmp_result variable sometimes points to original required_outer.
This patch adds new ways which optimizer can generate plans. One
possible way is optimizer reparameterizes an inner by a plain relation
from the outer (maybe as a result of join of the plain relation and
partitioned relation). In this case we have to compare tmp_result with
original pointer to realize, it was changed or not.
The patch in attachment fixes this problem. Additional regression test
added.

--
regards,
Andrey Lepikhov
Postgres Professional

Attachment Content-Type Size
v18-0001-Asymmetric-partitionwise-join.patch text/x-patch 39.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey V. Lepikhov 2021-09-14 06:43:03 Re: Increase value of OUTER_VAR
Previous Message Michael Paquier 2021-09-14 06:06:41 Re: Add jsonlog log_destination for JSON server logs