Re: speeding up planning with partitions

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Imai Yoshikazu <yoshikazu_i443(at)live(dot)jp>, "jesper(dot)pedersen(at)redhat(dot)com" <jesper(dot)pedersen(at)redhat(dot)com>, "Imai, Yoshikazu" <imai(dot)yoshikazu(at)jp(dot)fujitsu(dot)com>, "'Amit Langote'" <amitlangote09(at)gmail(dot)com>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: speeding up planning with partitions
Date: 2019-03-27 03:06:04
Message-ID: 47d2fd82-3f70-077b-abc6-863e3fa23503@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers

On 2019/03/27 7:26, Tom Lane wrote:
> Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> writes:
>> On 2019/03/23 6:07, Tom Lane wrote:
>>> I also feel like you used a dartboard while deciding where to insert the
>>> call in query_planner(); dropping it into the middle of a sequence of
>>> equivalence-class-related operations seems quite random. Maybe we could
>>> delay that step all the way to just before make_one_rel, since the other
>>> stuff in between seems to only care about baserels? For example,
>>> it'd certainly be better if we could run remove_useless_joins before
>>> otherrel expansion, so that we needn't do otherrel expansion at all
>>> on a table that gets thrown away as being a useless join.
>
>> create_lateral_join_info() expects otherrels to be present to propagate
>> the information it creates.
>
> Sure, but the actually-useful work in that function is just concerned
> with baserels. The only thing it does with otherrels is to propagate
> parents' lateral-ref info to children, which is a lot easier, cheaper,
> and more reliable if we let build_simple_rel do it. See the version
> of 0001 I just pushed.

Thanks a lot for reviewing and committing. I like the idea of setting
lateral info in build_simple_rel() itself. In fact, that's how early
versions of the patches did.

> I'll look at 0003 and up tomorrow.

Attached rebased patches.

I wonder if I should rework inherit.c so that its internal interfaces
don't pass around parent Relation, but make do with the RelOptInfo? I'll
need to add tupdesc and reltype fields to RelOptInfo to go ahead with that
though.

Thanks,
Amit

Attachment Content-Type Size
v37-0001-Delay-adding-inheritance-child-tables-until-quer.patch text/plain 40.7 KB
v37-0002-Perform-pruning-in-expand_partitioned_rtentry.patch text/plain 30.5 KB
v37-0003-Teach-planner-to-only-process-unpruned-partition.patch text/plain 7.3 KB
v37-0004-Fix-inheritance_planner-to-avoid-useless-work.patch text/plain 6.4 KB
v37-0005-Adjust-inheritance_planner-to-reuse-source-child.patch text/plain 24.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2019-03-27 03:13:16 Re: Misleading errors with column references in default expressions and partition bounds
Previous Message Michael Paquier 2019-03-27 03:04:14 Re: pg_malloc0() instead of pg_malloc()+memset()