From: | Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp> |
---|---|
To: | Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp |
Cc: | robertmhaas(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Constraint merge and not valid status |
Date: | 2016-07-26 02:05:27 |
Message-ID: | 20160726.110527.172830280.horiguchi.kyotaro@lab.ntt.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello,
At Mon, 25 Jul 2016 18:21:27 +0900, Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp> wrote in <96fb8bca-57f5-e5a8-9630-79d4fc5b213e(at)lab(dot)ntt(dot)co(dot)jp>
>
> Hello,
>
> On 2016/07/25 17:18, Kyotaro HORIGUCHI wrote:
> >
> > - Remove ccvalid condition from equalTupleDescs() to reduce
> > unnecessary cache invalidation or tuple rebuilding.
>
> The following commit introduced the ccvalid check:
>
> """
> commit c31305de5f5a4880b0ba2f5983025ef0210a3b2a
> Author: Noah Misch <noah(at)leadboat(dot)com>
> Date: Sun Mar 23 02:13:43 2014 -0400
>
> Address ccvalid/ccnoinherit in TupleDesc support functions.
>
> equalTupleDescs() neglected both of these ConstrCheck fields, and
> CreateTupleDescCopyConstr() neglected ccnoinherit. At this time, the
> only known behavior defect resulting from these omissions is constraint
> exclusion disregarding a CHECK constraint validated by an ALTER TABLE
> VALIDATE CONSTRAINT statement issued earlier in the same transaction.
> Back-patch to 9.2, where these fields were introduced.
> """
Wow.. Missed the obvious thing. Certainly relation cache must be
invalidated by a change of ccvalidated as the commit message.
> So, apparently RelationClearRelation() does intend to discard a cached
> TupleDesc if ccvalid changed in a transaction. Whereas,
> acquire_inherited_sample_rows() does not seem to depend on ccvalid being
> equal or not (or any member of TupleConstr for that matter). So maybe,
> instead of simply discarding the check (which does serve a purpose), we
> could make equalTupleDescs() parameterized on whether we want TupleConstr
> equality check to be performed or not. RelationClearRelation() can ask
> for the check to be performed by passing true for the parameter whereas
> acquire_inherited_sample_rows() and other callers can pass false. Perhaps
> something like the attached.
Hmm. It should resolve the problem. But the two comparisons seem
to be separate things. Constraints is not a part of tuple
description. relcache seems to be making misusage of the equality
of tuple descriptors.
So, how about splitting the original equalTupleDescs into
equalTupleDescs and equalTupleConstraints ?
regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachment | Content-Type | Size |
---|---|---|
0001-Split-equalTupleDescs-into-two-functions.patch | text/x-patch | 1.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2016-07-26 02:09:58 | Re: AdvanceXLInsertBuffer vs. WAL segment compressibility |
Previous Message | Michael Paquier | 2016-07-26 01:48:52 | Re: [PATCH v12] GSSAPI encryption support |