Skip to content

docs: explain how a connection maps to a session and a backend - #285

Draft
Kiran01bm wants to merge 2 commits into
mainfrom
kiran01bm/docs-session-backend-mapping
Draft

Kiran01bm wants to merge 2 commits into
mainfrom
kiran01bm/docs-session-backend-mapping

Conversation

@Kiran01bm

Copy link
Copy Markdown
Collaborator

docs/session-affinity.md now explains how a client connection maps to a PostgreSQL session and backend, directly and behind each pooler mode.

Why

The page says session state lives "per server session, not per client connection" without saying what a session is. A reader new to PostgreSQL can't tell why a pooler changes anything, which is the whole reason pg-sprite needs session affinity.

What

  • New subsection "Connection, session and backend": one backend per accepted connection, and that backend is the session; a table of how long a client connection keeps its backend for direct, session, transaction and statement mode; a short diagram.
  • The existing state table moves under "What pg-sprite keeps in the session", and its lead-in now says "per backend".
  • Contents updated.

Before / after

A reader asks why a transaction-mode pooler loses pg-sprite's lock_timeout.

Before
  "state PostgreSQL keeps per server session, not per client connection"
  reader: what is a session, and why would a pooler change it?

After
  client conn ── tx 1 ──▶ backend A   (SET lock_timeout lives in A)
              ── tx 2 ──▶ backend B   (transaction mode: B never saw it)
  reader: the session is the backend; only direct and session mode keep it

🤖 Generated with Amp (Claude Opus 4.6)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant