From: David Rowley <david.rowley@2ndquadrant.com>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
Cc: pgsql-committers <pgsql-committers@postgresql.org>
Subject: Re: pgsql: Clarify use of temporary tables within partition trees
Date: Tue, 3 Jul 2018 21:05:41 +1200
Message-ID: <CAKJS1f8Wt3CoYY-7AqtbszBLPrQMaH3xLRd2pSCKDARhQRT__A@mail.gmail.com> (raw)
In-Reply-To: <d5059f0a-9a93-942f-5a8a-ecd13fc26b94@lab.ntt.co.jp>
References: <CAKJS1f_HyV1txn_4XSdH5EOhBMYaCwsXyAj6bHXk9gOu4JKsbw@mail.gmail.com>
<CA+TgmoY5EOxJSJCxH09rL1bpFHojpcAKyRym1Y=FiCpOv151mw@mail.gmail.com>
<20180702221650.GA2159@paquier.xyz>
<CAKJS1f9bFnkWX3iDC0DgCdwDSaAMYjWbENmek23FGQx9FkLREw@mail.gmail.com>
<20180703045502.GA26236@paquier.xyz>
<CAKJS1f8f8+3FOBhSoopo15uzHsY76+L8cMKhMwBi+x+bvBU7tg@mail.gmail.com>
<20180703061119.GA11732@paquier.xyz>
<CAKJS1f8h8283Vb2NcQH+YOMErdDQZWGuqGoe-gX6yT8TKGf0MA@mail.gmail.com>
<5db5fe6e-4a73-6a24-09e4-060b9f132ea9@lab.ntt.co.jp>
<b7cc212d-8455-c548-5a71-3cbf6133abd6@lab.ntt.co.jp>
<20180703070551.GC11732@paquier.xyz>
<d5059f0a-9a93-942f-5a8a-ecd13fc26b94@lab.ntt.co.jp>
(re-adding committers list)
On 3 July 2018 at 20:31, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> wrote:
> 1. I still insist that it's better for the newly added code to be near the
> top of the function body than in the middle, which brings me to...
That will cause the AppendRelInfo not to be built for a partitioned
table with no partitions. I'm not personally certain that doing that
comes without consequence. Are you certain of that? If not 100%,
then I think that's more of a task for PG12. I'm trying to propose
removing dead code for PG11 and on.
My current thoughts are that moving this test up a few lines is
unlikely to improve performance in a real-world situation, so it does
not seem worth the risk for a backpatch to me.
> 2. While we're at fixing the code around here, I think we should think
> about trying to get rid of the *non-dead* code that produces a structure
> that isn't used anywhere, which I was under the impression, 0a480502b09
> [1] already did (cc'ing Ashutosh). To clarify, we still unnecessarily
> create a "duplicate" RTE for partitioned tables in a partition tree
> (non-leaf tables) in its role as a child. So, for the above query, there
> end up being created 4 entries in the query's range table (2 for 'p' and 2
> for 'pd'). That makes sense for plain inheritance, because even the root
> parent table in a plain inheritance tree is a regular table containing
> data. That's not true for partition inheritance trees, where non-leaf
> tables contain no data, so we don't create a plan to scan them (see
> d3cc37f1d80 [2]), which in turn means we don't need to create the
> redundant "duplicate" child RTEs for them either.
>
> See attached my delta patch to address both 1 and 2.
I recently saw this too and wondered about it. I then wrote a patch to
just have it create a single RangeTblEntry for each partitioned table.
The tests all passed.
I'd categorise this one the same as I have #1 above, i.e. not
backpatch material. It seems like something useful to look into for
v12 though. I assumed this was done for a reason and that I just
didn't understand what that reason was. I don't recall any comments to
explain the reason why we build two RangeTblEntrys for each
partitioned table.
In light of what Amit has highlighted, I'm still standing by the v3
patch assuming the typo is fixed.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: david.rowley@2ndquadrant.com, Langote_Amit_f8@lab.ntt.co.jp, michael@paquier.xyz, robertmhaas@gmail.com, ashutosh.bapat@enterprisedb.com
Subject: Re: pgsql: Clarify use of temporary tables within partition trees
In-Reply-To: <CAKJS1f8Wt3CoYY-7AqtbszBLPrQMaH3xLRd2pSCKDARhQRT__A@mail.gmail.com>
References: <CAKJS1f_HyV1txn_4XSdH5EOhBMYaCwsXyAj6bHXk9gOu4JKsbw@mail.gmail.com> <CA+TgmoY5EOxJSJCxH09rL1bpFHojpcAKyRym1Y=FiCpOv151mw@mail.gmail.com> <20180702221650.GA2159@paquier.xyz> <CAKJS1f9bFnkWX3iDC0DgCdwDSaAMYjWbENmek23FGQx9FkLREw@mail.gmail.com> <20180703045502.GA26236@paquier.xyz> <CAKJS1f8f8+3FOBhSoopo15uzHsY76+L8cMKhMwBi+x+bvBU7tg@mail.gmail.com> <20180703061119.GA11732@paquier.xyz> <CAKJS1f8h8283Vb2NcQH+YOMErdDQZWGuqGoe-gX6yT8TKGf0MA@mail.gmail.com> <5db5fe6e-4a73-6a24-09e4-060b9f132ea9@lab.ntt.co.jp> <b7cc212d-8455-c548-5a71-3cbf6133abd6@lab.ntt.co.jp> <20180703070551.GC11732@paquier.xyz> <d5059f0a-9a93-942f-5a8a-ecd13fc26b94@lab.ntt.co.jp> <CAKJS1f8Wt3CoYY-7AqtbszBLPrQMaH3xLRd2pSCKDARhQRT__A@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox