Re: Tuple visibility within a single XID - Mailing list pgsql-hackers

From Qingqing Zhou
Subject Re: Tuple visibility within a single XID
Date
Msg-id CAJjS0u3_WG0JENwQ6MNFGXsWSj=fnPtma9ry_qmzZhorw1t-kw@mail.gmail.com
Whole thread Raw
In response to Re: Tuple visibility within a single XID  (Peter Geoghegan <pg@heroku.com>)
Responses Re: Tuple visibility within a single XID
Re: Tuple visibility within a single XID
List pgsql-hackers
On Tue, Apr 7, 2015 at 6:11 PM, Peter Geoghegan <pg@heroku.com> wrote:
> No. For one thing, unique index enforcement still requires the tuples
> to be treated as a conflict while the other transaction is running
> IMV.
>

Not sure if I understand correctly: in uniqueness check, we see all
possible tuples with a dirty snapshot.  For a tuple version inserted
and updated by myself, it is surely dead no matter how the transaction
ends. So I interpret that we can safely pruning the version.

Early pruning may cause some behavior change though. For example, here is a T1:

begin;  -- loop the following statements many times  insert into pk values (1);  -- uniqueness defined  delete from
pk;
abort;

If another transaction T2 coming later than T1, and if we prune early,
then T1 can suddenly hang on insertion waiting for T2 to complete. But
does this violate any isolation rule?
Thanks,
Qingqing



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pg_regress writes into source tree
Next
From: Fujii Masao
Date:
Subject: Re: pg_rewind and log messages