RE: serializable master and non-serializable hot standby: feasible set up?

From: "Clay Jackson (cjackson)" <Clay(dot)Jackson(at)quest(dot)com>
To: Jacob Biesinger <jake(dot)biesinger(at)gmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: RE: serializable master and non-serializable hot standby: feasible set up?
Date: 2024-10-16 03:32:26
Message-ID: CO1PR19MB498475E00A86044B340A0B399B462@CO1PR19MB4984.namprd19.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Just out of curiosity, what's the use case for this?

Clay Jackson
Database Solutions Sales Engineer
[cid:image001(dot)jpg(at)01DB1F41(dot)568B8100]<https://www.quest.com/solutions/database-performance-monitoring/>
clay(dot)jackson(at)quest(dot)com<mailto:clay(dot)jackson(at)quest(dot)com>
office 949-754-1203 mobile 425-802-9603

From: Jacob Biesinger <jake(dot)biesinger(at)gmail(dot)com>
Sent: Tuesday, October 15, 2024 4:28 PM
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: serializable master and non-serializable hot standby: feasible set up?

CAUTION: This email originated from outside of the organization. Do not follow guidance, click links, or open attachments unless you recognize the sender and know the content is safe.

Howdy!

I've been going back and forth with the GCP CloudSQL engineering team about the feasibility of a particular setup, and I'm pinging the list here hoping for a sanity check. They assure me that it's impossible and I think they must be mistaken, but I have limited experience administrating my own postgres instances. So I'm appealing to a higher authority :)

The docs outline[1<https://www.postgresql.org/docs/current/hot-standby.html>][2<https://www.postgresql.org/docs/current/applevel-consistency.html#SERIALIZABLE-CONSISTENCY>] that a hot standby / replica with the flag `default_transaction_isolation='serializable'` is going to cause issues -- while you can connect to such an instance, basically every query against it will fail.

But! If you can somehow manage to get the replica's flags to instead use `repeatable read` or `read committed` isolation, everything seems to work well, even if the master uses `serializable` isolation. In GCP, we are having to temporarily swap the master to a lower isolation level, then stand up the replica and pin the lower isolation level flag, and then finally revert the flag change on the master. If the replica goes down, we have to repeat this process and it's a pain (not to mention data issues since our app relies on this isolation level instead of doing explicit locking in most cases).

So I know this is an awkward question to post here, but as postgres admin professionals, *would you* expect to be able to stand up a `repeatable read` replica against a `serializable` master? My expectation is that you'd simply change the setting in a .conf file on the replica and be good to go; is there something that would make this process really difficult / impossible?

Thanks so much!

[1]: https://www.postgresql.org/docs/current/hot-standby.html
[2]: https://www.postgresql.org/docs/current/applevel-consistency.html#SERIALIZABLE-CONSISTENCY
--
Jake Biesinger

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Laurenz Albe 2024-10-16 04:23:38 Re: serializable master and non-serializable hot standby: feasible set up?
Previous Message Jacob Biesinger 2024-10-15 23:27:49 serializable master and non-serializable hot standby: feasible set up?