Re: SQL:2011 application time

From: Paul Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Isaac Morland <isaac(dot)morland(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, Peter Eisentraut <peter(at)eisentraut(dot)org>, jian he <jian(dot)universality(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL:2011 application time
Date: 2024-07-05 19:22:31
Message-ID: e5296c1d-f11b-4706-8e69-3ca2b87b9f80@illuminatedcomputing.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Here is v35 of this patch series, with a few small changes. I renamed relperiods to
relwithoutoverlaps, since that is more accurate about what we're counting. (PERIODs come in a later
patch and we don't need to count them.) Also I cleaned up the branches in psql/pg_dump on version
now that we're officially on v18.

On 6/28/24 05:18, Robert Haas wrote:
> On Thu, Jun 27, 2024 at 5:56 PM Paul Jungwirth
> <pj(at)illuminatedcomputing(dot)com> wrote:
>> I did add a relperiods column, but I have a mostly-complete branch here (not included in the
>> patches) that does without. Not maintaining that new column is simpler for sure. The consequence is
>> that the relcache must scan for WITHOUT OVERLAPS constraints on every table. That seems like a high
>> performance cost for a feature most databases won't use. Since we try hard to avoid that kind of
>> thing (e.g. [1]), I thought adding relperiods would be preferred. If that's the wrong tradeoff I can
>> change it.
>
> I'm sure that you are right that nobody is going to like an extra
> index scan just to find periods. So, suppose we do as you propose and
> add relperiods. In the situation where we are adding the first period
> (or whatever the right term is) to the table, what kind of lock are we
> holding on the table? Conversely, when we drop the last period, what
> kind of lock are we holding on the table? If, hypothetically, both
> answers were AccessExclusiveLock, this might not be too bad, but if
> you say "ShareLock" then we've got a lot of problems; that's not even
> self-exclusive.

This happens when creating a PRIMARY KEY or UNIQUE constraint, so we already have an
AccessExclusiveLock on the table (whether creating or dropping). If we ever supported CREATE INDEX
CONCURRENTLY for this, we would need to be careful about where we update the new field, but today we
don't support that for exclusion constraints.

Rebased to 4b211003ec.

Yours,

--
Paul ~{:-)
pj(at)illuminatedcomputing(dot)com

Attachment Content-Type Size
v35-0001-Add-stratnum-GiST-support-function.patch text/x-patch 20.6 KB
v35-0002-Add-temporal-PRIMARY-KEY-and-UNIQUE-constraints.patch text/x-patch 128.2 KB
v35-0003-Forbid-empty-ranges-multiranges-in-WITHOUT-OVERL.patch text/x-patch 47.8 KB
v35-0004-Add-temporal-FOREIGN-KEY-contraints.patch text/x-patch 162.4 KB
v35-0005-Add-support-funcs-for-FOR-PORTION-OF.patch text/x-patch 43.0 KB
v35-0006-Add-UPDATE-DELETE-FOR-PORTION-OF.patch text/x-patch 160.3 KB
v35-0007-Add-CASCADE-SET-NULL-SET-DEFAULT-for-temporal-fo.patch text/x-patch 200.1 KB
v35-0008-Add-PERIODs.patch text/x-patch 282.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message feichanghong 2024-07-05 19:39:41 Re: Optimize commit performance with a large number of 'on commit delete rows' temp tables
Previous Message Paul Jungwirth 2024-07-05 18:46:07 Add GiST support for mixed-width integer operators