You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncpg version: 0.30.0 PostgreSQL version: 16.6
Do you use a PostgreSQL SaaS? If so, which? AWS Postgres Aurora
Can you reproduce: yes
Python version: 3.11
Do you use pgbouncer?: yes
Did you install asyncpg with pip?: yes
If you built asyncpg locally, which version of Cython did you use?: N/A
Can the issue be reproduced under both asyncio and
uvloop?: yes
When using PgBouncer in session mode with asyncpg, setting NullPool in SQLAlchemy (asyncpg) is required to avoid per-process connection pools. However, this causes asyncpg to trigger type introspection queries on every connection checkout from PgBouncer Pool. Even when jit=off, type introspection queries take a few milliseconds each time, adding unnecessary overhead.
Since introspection happens only once per connection, a solution is needed to preload type codecs and prevent repeated introspection queries.
Provide a mechanism to preload type codecs once per connection, ensuring that asyncpg does not re-run introspection queries on every checkout from the PgBouncer pool. This would improve performance when using asyncpg with external connection pooling solutions like PgBouncer.
Would love to hear thoughts from the community on potential solutions or workarounds!
The text was updated successfully, but these errors were encountered:
asyncpg version: 0.30.0
PostgreSQL version: 16.6
Do you use a PostgreSQL SaaS? If so, which? AWS Postgres Aurora
Can you reproduce: yes
Python version: 3.11
Do you use pgbouncer?: yes
Did you install asyncpg with pip?: yes
If you built asyncpg locally, which version of Cython did you use?: N/A
Can the issue be reproduced under both asyncio and
uvloop?: yes
When using PgBouncer in session mode with asyncpg, setting NullPool in SQLAlchemy (asyncpg) is required to avoid per-process connection pools. However, this causes asyncpg to trigger type introspection queries on every connection checkout from PgBouncer Pool. Even when jit=off, type introspection queries take a few milliseconds each time, adding unnecessary overhead.
Since introspection happens only once per connection, a solution is needed to preload type codecs and prevent repeated introspection queries.
Provide a mechanism to preload type codecs once per connection, ensuring that asyncpg does not re-run introspection queries on every checkout from the PgBouncer pool. This would improve performance when using asyncpg with external connection pooling solutions like PgBouncer.
Would love to hear thoughts from the community on potential solutions or workarounds!
The text was updated successfully, but these errors were encountered: