public inbox for [email protected]  
help / color / mirror / Atom feed
From: Heikki Linnakangas <[email protected]>
To: Wirch, Eduard <[email protected]>
Cc: [email protected]
Subject: Re: PostgreSql: Canceled on conflict out to old pivot
Date: Fri, 1 Dec 2023 01:35:09 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAPX+m-jF52dHkve0et0WAScC2JkELChdmxVUNbTCrDM0oq903Q@mail.gmail.com>
References: <CAPX+m-hdbj4b1Ufcpx+YAGj8BLF91gdi6zr0Pc3NKZTBDtKUrQ@mail.gmail.com>
	<[email protected]>
	<CAPX+m-jF52dHkve0et0WAScC2JkELChdmxVUNbTCrDM0oq903Q@mail.gmail.com>

On 30/11/2023 18:24, Wirch, Eduard wrote:
>  > > The longest transaction that could occur is 1 min long.
>> I hate to drill on this, but are you very sure about that? A transaction 
> in a different database?
> 
> Don't be sorry for that, drilling down is important. ;) It took me so 
> long to reply because I had to prepare the information carefully. You're 
> right, on that day I observed the behavior, there were indeed long 
> running transactions in different DBs!

A-ha! :-D

> My understanding of serializable isolation is that only transactions
> which can somehow affect each other can conflict. It should be clear
> for PostgreSql, that transactions belonging to different databases
> cannot affect each other. Why do they cause serializable conflicts?

When the system runs low on the memory reserved to track the potential 
conflicts, it "summarizes" old transactions and writes them to disk. The 
summarization loses a lot of information: all we actually store on disk 
is the commit sequence number of the earliest "out-conflicting" 
transaction. We don't store the database oid that the transaction ran in.

The whole SSI mechanism is conservative so that you can get false 
serialization errors even when there is no actual problem. This is just 
an extreme case of that.

Perhaps we should keep more information in the on-disk summary format. 
Preserving the database OID would make a lot of sense, it would be only 
4 bytes extra per transaction. But we don't preserve it today.

> If you want something visual, I prepared a SO question with similar 
> content like this mail, but added an image of the tx flow: 
> https://stackoverflow.com/questions/77544821/postgresql-canceled-on-conflict-out-to-old-pivot <https://stackoverflow.com/questions/77544821/postgresql-canceled-on-conflict-out-to-old-pivot;

Nice graphs!

-- 
Heikki Linnakangas
Neon (https://neon.tech)







view thread (5+ 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]
  Subject: Re: PostgreSql: Canceled on conflict out to old pivot
  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