Re: [PoC] Reducing planning time when tables have many partitions

From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
To: Yuya Watari <watari(dot)yuya(at)gmail(dot)com>, David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Thom Brown <thom(at)linux(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Zhang Mingli <zmlpostgres(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PoC] Reducing planning time when tables have many partitions
Date: 2023-09-19 08:21:15
Message-ID: 4b47ca57-39ce-aa3c-7b6f-6fc0d15a3d0d@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 25/8/2023 14:39, Yuya Watari wrote:
> Hello,
>
> On Wed, Aug 9, 2023 at 8:54 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>> I think the best way to move this forward is to explore not putting
>> partitioned table partitions in EMs and instead see if we can
>> translate to top-level parent before lookups. This might just be too
>> complex to translate the Exprs all the time and it may add overhead
>> unless we can quickly determine somehow that we don't need to attempt
>> to translate the Expr when the given Expr is already from the
>> top-level parent. If that can't be made to work, then maybe that shows
>> the current patch has merit.
>
> Based on your suggestion, I have experimented with not putting child
> EquivalenceMembers in an EquivalenceClass. I have attached a new
> patch, v20, to this email. The following is a summary of v20.
Working on self-join removal in the thread [1] nearby, I stuck into the
problem, which made an additional argument to work in this new direction
than a couple of previous ones.
With indexing positions in the list of equivalence members, we make some
optimizations like join elimination more complicated - it may need to
remove some clauses and equivalence class members.
For changing lists of derives or ec_members, we should go through all
the index lists and fix them, which is a non-trivial operation.

[1]
https://www.postgresql.org/message-id/flat/64486b0b-0404-e39e-322d-0801154901f3%40postgrespro.ru

--
regards,
Andrey Lepikhov
Postgres Professional

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pierre Ducroquet 2023-09-19 08:25:09 Re: Improvements in pg_dump/pg_restore toc format and performances
Previous Message Peter Eisentraut 2023-09-19 08:07:49 Re: Standardize type of variable when extending Buffers