Schrödinger’s Connection: Mastering PG State with Semantic Virtualization
Charly Batista
EDB
A deep dive into PostgreSQL session state, protocol internals, and why modern proxies must understand, not just forward, connections!
Anyone who has operated PostgreSQL at scale eventually learns an uncomfortable truth: connections are not stateless. Session variables, prepared statements, transaction snapshots, advisory locks, temporary objects, GUCs, and protocol state all quietly accumulate behind every client connection. Traditional poolers mostly pretend this complexity does not exist.
Usually, that works. Until it doesn’t.
In this talk, we’ll explore how subtle session-state desynchronization can trigger strange behavior ranging from broken transactions and inconsistent reads to replica instability and hard-to-debug operational failures. We’ll also look at why modern workloads with aggressive pooling, failover, multiplexing, and distributed architectures push traditional connection management beyond its original design assumptions.
Using Keel as a case study, we’ll dive deep into the PostgreSQL wire protocol and introduce the concept of Semantic State Virtualization: a protocol-aware approach that allows a proxy to understand, track, virtualize, and safely migrate PostgreSQL session state across backend connections.
Topics include:
- PostgreSQL protocol internals
- Transaction and session state tracking
- Prepared statement virtualization
- Safe connection multiplexing
- Session recovery during backend failure
- Why “just pooling connections” becomes a distributed systems problem surprisingly fast
This is a talk about the messy reality hidden behind “simple” database connections, and why the next generation of PostgreSQL infrastructure needs proxies that do more than blindly forward packets.
Schrödinger’s Connection: Mastering PG State with Semantic Virtualization
Charly Batista
EDB
A deep dive into PostgreSQL session state, protocol internals, and why modern proxies must understand, not just forward, connections!
Anyone who has operated PostgreSQL at scale eventually learns an uncomfortable truth: connections are not stateless. Session variables, prepared statements, transaction snapshots, advisory locks, temporary objects, GUCs, and protocol state all quietly accumulate behind every client connection. Traditional poolers mostly pretend this complexity does not exist.
Usually, that works. Until it doesn’t.
In this talk, we’ll explore how subtle session-state desynchronization can trigger strange behavior ranging from broken transactions and inconsistent reads to replica instability and hard-to-debug operational failures. We’ll also look at why modern workloads with aggressive pooling, failover, multiplexing, and distributed architectures push traditional connection management beyond its original design assumptions.
Using Keel as a case study, we’ll dive deep into the PostgreSQL wire protocol and introduce the concept of Semantic State Virtualization: a protocol-aware approach that allows a proxy to understand, track, virtualize, and safely migrate PostgreSQL session state across backend connections.
Topics include:
- PostgreSQL protocol internals
- Transaction and session state tracking
- Prepared statement virtualization
- Safe connection multiplexing
- Session recovery during backend failure
- Why “just pooling connections” becomes a distributed systems problem surprisingly fast
This is a talk about the messy reality hidden behind “simple” database connections, and why the next generation of PostgreSQL infrastructure needs proxies that do more than blindly forward packets.