Re: improving foreign key locks - Mailing list pgsql-hackers

From Florian Pflug
Subject Re: improving foreign key locks
Date
Msg-id 976C0EBC-2184-49F1-9042-27219E9FB2E3@phlo.org
Whole thread Raw
In response to Re: improving foreign key locks  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Dec1, 2010, at 18:44 , Tom Lane wrote:
> Florian Pflug <fgp@phlo.org> writes:
>> On Dec1, 2010, at 17:17 , Tom Lane wrote:
>>> There's not enough space in the infomask to record which columns (or
>>> which unique index) are involved.  And if you're talking about data that
>>> could remain on disk long after the unique index is gone, that's not
>>> going to be good enough.
>
>> We'd distinguish two cases
>>  A) The set of locked columns is a subset of the set of columns mentioned in
>>     *any* unique index. (In other words, for every locked column there is a
>>     unique index which includes that column, though not necessarily one index
>>     which includes them all)
>>  B) The set of locked columns does not satisfy (A)
>
>> Creating indices shouldn't pose a problem, since it would only enlarge the set of locked columns for rows with
HEAP_XMAX_SHARED_LOCK_KEYset. 
>
> Not with that definition.  I could create a unique index that doesn't
> contain some column that every previous unique index contained.
Hm, I seem to be unable to put the definition into unambiguous words. Let me try again.

Set A contains all columns for which an unique index exist which includes said column. More formally, if C_i is the set
ofcolumns included in the index I, then A is the union over all C_i with I ranging over the unique indices. 

If for example index unique index I1 contains the columns (a,b) and unique index I2 contains the columns (b,c) (and no
otherunique indices exist) then the set contains the columns a,b,c. If there is an additional index I3 on (d), then A =
{a,b,c,d}.If a row is SHARE locked and HEAP_XMAX_SHARED_LOCK_KEY is set, only these columns are considered to be
locked.If the flag is not set, all columns are considered locked. 

best regards,
Florian Pflug



pgsql-hackers by date:

Previous
From: Greg Smith
Date:
Subject: Re: Spread checkpoint sync
Next
From: Dimitri Fontaine
Date:
Subject: Re: pg_execute_from_file review