Re: Optimizing nested ConvertRowtypeExpr execution

From: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimizing nested ConvertRowtypeExpr execution
Date: 2018-04-03 05:18:26
Message-ID: CAFjFpRfr9RX-=HJt5Z6KiYJObtd+mvSSmoxqFPPoYKxv8KX7Aw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Apr 2, 2018 at 1:40 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> Hi,
>
> On 2018-02-26 17:20:05 +0530, Ashutosh Bapat wrote:
>> In a multi-level partitioned table, a parent whole-row reference gets
>> translated into nested ConvertRowtypeExpr with child whole-row
>> reference as the leaf. During the execution, the child whole-row
>> reference gets translated into all all intermediate parents' whole-row
>> references, ultimately represented as parent's whole-row reference.
>> AFAIU, the intermediate translations are unnecessary. The leaf child
>> whole-row can be directly translated into top parent's whole-row
>> reference. Here's a WIP patch which does that by eliminating
>> intermediate ConvertRowtypeExprs during ExecInitExprRec().
>
> Why is this done appropriately at ExecInitExpr() time, rather than at
> plan time? Seems like eval_const_expressions() would be a bit more
> appropriate (being badly named aside...)?

That seems to be a better idea. Here's patch.

--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company

Attachment Content-Type Size
0001-Optimize-nested-ConvertRowtypeExprs.patch text/x-patch 2.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2018-04-03 05:45:12 Re: Commit 4dba331cb3 broke ATTACH PARTITION behaviour.
Previous Message Michael Paquier 2018-04-03 05:11:46 Re: BUG #14941: Vacuum crashes