Cross-database SERIALIZABLE safe snapshots - Mailing list pgsql-hackers

From Thomas Munro
Subject Cross-database SERIALIZABLE safe snapshots
Date
Msg-id CA+hUKGLqUAbpvO-aRznvF2LXnVBuRkYa7NcEG65C7Z0nziWKqw@mail.gmail.com
Whole thread Raw
Responses Re: Cross-database SERIALIZABLE safe snapshots  (Heikki Linnakangas <hlinnaka@iki.fi>)
List pgsql-hackers
Here is a feature idea that emerged from a pgsql-bugs thread[1] that I
am kicking into the next commitfest.  Example:

s1: \c db1
s1: CREATE TABLE t (i int);
s1: BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE;
s1: INSERT INTO t VALUES (42);

s2: \c db2
s2: BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE READ ONLY DEFERRABLE;
s2: SELECT * FROM x;

I don't know of any reason why s2 should have to wait, or
alternatively, without DEFERRABLE, why it shouldn't immediately drop
from SSI to SI (that is, opt out of predicate locking and go faster).
This change relies on the fact that PostgreSQL doesn't allow any kind
of cross-database access, except for shared catalogs, and all catalogs
are already exempt from SSI.  I have updated this new version of the
patch to explain that very clearly at the place where that exemption
happens, so that future hackers would see that we rely on that fact
elsewhere if reconsidering that.

[1] https://www.postgresql.org/message-id/flat/17368-98a4f99e8e4b4402%40postgresql.org

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Time delayed LR (WAS Re: logical replication restrictions)
Next
From: Amit Kapila
Date:
Subject: Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher