From: | Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Amit Langote <amitlangote09(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Optimise default partition scanning while adding new partition |
Date: | 2017-09-26 08:27:44 |
Message-ID: | 1f08b844-0078-aa8d-452e-7af3bf77d05f@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2017/09/16 1:57, Amit Langote wrote:
> On Sat, Sep 16, 2017 at 12:59 AM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> I believe the intended advantage of the current system is that if you
>> specify multiple operations in a single ALTER TABLE command, you only
>> do one scan rather than having a second scan per operation. If that's
>> currently working, we probably don't want to make it stop working.
>
> OK.
>
> How about squash Jeevan's and my patch, so both
> check_default_allows_bound() and ValidatePartitionConstraints() know
> to scan default partition's children and there won't be any surprises
> in the regression test output as you found after applying just the
> Jeevan's patch. Unfortunately, I'm not able to post such a patch
> right now.
I guess we don't need to squash, as they could be seen as implementing
different features. Reordering the patches helps though. So, apply them
in this order:
1. My patch to teach ValidatePartitionConstraints() to skip scanning
a partition's own partitions, which optimizes ATTACH PARTITION
command's partition constraint validation scan (this also covers the
case of scanning the default partition to validate its updated
constraint when attaching a new partition)
2. Jeevan's patch to teach check_default_allows_bound() to skip scanning
the default partition's own partitions, which covers the case of
scanning the default partition to validate its updated constraint when
adding a new partition using CREATE TABLE
Attached 0001 and 0002 are ordered that way.
In addition to implementing the features mentioned in 1 and 2 above, the
patches also modify the INFO message to mention "updated partition
constraint for default partition \"%s\"", instead of "partition constraint
for table \"%s\"", when the default partition is involved. That's so that
it's consistent with the error message that would be emitted by either
check_default_allows_bound() or ATRewriteTable() when the scan finds a row
that violates updated default partition constraint, viz. the following:
"updated partition constraint for default partition \"%s\" would be
violated by some row"
Thoughts?
Thanks,
Amit
Attachment | Content-Type | Size |
---|---|---|
0001-Teach-ValidatePartitionConstraints-to-skip-validatio.patch | text/plain | 6.3 KB |
0002-Skip-scanning-default-partition-s-child-tables-if-po.patch | text/plain | 9.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Maksim Milyutin | 2017-09-26 08:51:26 | Re: Repetitive code in RI triggers |
Previous Message | Craig Ringer | 2017-09-26 07:55:49 | Re: Built-in plugin for logical decoding output |