Repository navigation
docs: say what PgBouncer compatibility depends on, and what pre-ping costs behind it - #67
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This was referenced Oct 16, 2026
AlexeyShalaev
force-pushed
the
docs/58-60-pgbouncer
branch
from
October 16, 2026 16:18
bc47181 to
52ae8f4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #58.
Closes #60.
One PR for both: they rewrite the same PgBouncer section of the configuration guide, the same paragraph of the advanced guide, and rule 16 on the agents page. Docs and docstrings only, no behaviour change.
#60: what makes the library safe behind PgBouncer
The docs credited
AsyncCConnection(uuid statement names) and the "1.22" version boundary. Both were wrong:With
statement_cache_size=0(the default) asyncpg sends unnamed statements and never asks the connection class for a name. That is what makes any PgBouncer work. Withstatement_cache_size > 0, PgBouncer has to track prepared statements itself, andAsyncCConnectionand a plainasyncpg.Connectionpassed and failed in exactly the same runs (the issue's table, reproduced on 1.25.2).Version defaults, measured on stock images with nothing set:
This matches the PgBouncer changelog: the feature arrived in 1.21.0 behind the setting, and the default became 200 in 1.24.0.
Changed: the PgBouncer section, the advanced guide's compatibility paragraph, rule 16, and the
create_async_session_managerintro on the agents page. The table row "(the default before 1.22)" now says 1.24. TheAsyncCConnectiondocstring and theconnection_classargument doc describe what the class does and no longer claim PgBouncer compatibility.connection_classkeeps defaulting toAsyncCConnection: it's harmless, and swapping a default that does nothing is churn.#58: what pre-ping costs behind a transaction-mode PgBouncer
Reproduced on PgBouncer 1.25.2 with the issue's script: 20 PgBouncer transactions for 10 requests with
pre_ping=Trueversus 10 without, and withpre_ping=Truea 1.0 s checkout wait on a pool withtimeout=0.2and no timeout counted.The docs now say so: in the PgBouncer section, rule 16, and the advanced guide. The PgBouncer examples show
PoolSettings(pre_ping=False, recycle=300). The pool settings table pointspre_pingat the PgBouncer section, and the "turns intoconnection_timeouts_totalatpool_timeout" sentences (configuration guide, advanced guide, rule 17) are qualified: that holds for the pool's own queue only. The default staysTrue, which is right for direct connections.The
recycleadvice was measured too, with PgBouncerclient_idle_timeout=2, one request, 3 s idle, one request:Gate
make checkclean;make test626 passed. The docs build's only warning is the pre-existingchangelog.mdlink, which the Makefile target copies in before building.Lab scripts: the two issue scripts as posted, plus the version/idle-timeout lab above (testcontainers,
edoburu/pgbouncerimages 1.21.0-p2 through v1.25.2-p0).Overlaps with #63 (the
connection_timeouts_totalwording) indocs/agents.mdand the advanced guide. I'll rebase whichever lands second.