public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tom Lane <[email protected]>
To: Bruce Momjian <[email protected]>
Cc: Greg Stark <[email protected]>
Cc: David Zhang <[email protected]>
Cc: Simon Riggs <[email protected]>
Cc: Cary Huang <[email protected]>
Cc: Pgsql Hackers <[email protected]>
Subject: Re: Patch: Global Unique Index
Date: Tue, 29 Nov 2022 21:16:23 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<CANbhV-Eo4D2Njpa=YiBr7BxOMDi5B54wenjgoamRKjzj-9gBGQ@mail.gmail.com>
<Y4D/[email protected]>
<[email protected]>
<CAM-w4HNFyX2upz6pyeWXew-p2sPXiSy2q3tn_Zfa4Xvtu+SLhw@mail.gmail.com>
<[email protected]>
<[email protected]>
Bruce Momjian <[email protected]> writes:
> On Tue, Nov 29, 2022 at 06:13:56PM -0500, Tom Lane wrote:
>> ... not to mention creating a high probability of deadlocks between
>> concurrent insertions to different partitions. If they each
>> ex-lock their own partition's index before starting to look into
>> other partitions' indexes, it seems like a certainty that such
>> cases would fail. The rule of thumb about locking multiple objects
>> is that all comers had better do it in the same order, and this
>> isn't doing that.
> I am not sure why they would need to exclusive lock anything more than
> the unique index entry they are adding, just like UPDATE does.
Assuming that you are inserting into index X, and you've checked
index Y to find that it has no conflicts, what prevents another
backend from inserting a conflict into index Y just after you look?
AIUI the idea is to prevent that by continuing to hold an exclusive
lock on the whole index Y until you've completed the insertion.
Perhaps there's a better way to do that, but it's not what was
described.
I actually think that that problem should be soluble with a
slightly different approach. The thing that feels insoluble
is that you can't do this without acquiring sufficient locks
to prevent addition of new partitions while the insertion is
in progress. That will be expensive in itself, and it will
turn ATTACH PARTITION into a performance disaster.
regards, tom lane
view thread (33+ messages) latest in thread
reply
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 using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: Patch: Global Unique Index
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox