Dev-iL commented on PR #68496:
URL: https://github.com/apache/airflow/pull/68496#issuecomment-4700821045

   Caveat: psycopg3 uses **server-side** prepared statements (via 
protocol-level `PQsendPrepare`/`PQsendQueryPrepared`), not client-side. Its 
default `prepare_threshold=5` means it *will* create server-side prepared 
statements after 5 executions of the same query on a connection. Neither 
Airflow nor SQLAlchemy sets `prepare_threshold=None`.
   
   The psycopg3 docs explicitly warn that poolers are **not compatible** with 
prepared statements unless:
   - PgBouncer >= 1.22 (with `max_prepared_statements > 0`)
   - libpq from PostgreSQL >= 17 (client-side)
   - psycopg >= 3.2
   
   Our Helm chart ships PgBouncer 1.23.1 and pins psycopg >= 3.2.9, so the 
first and third conditions are met for chart users. But CI tests Postgres 14–18 
(default 14), so the libpq requirement (>= 17) is not always satisfied. Users 
running their own PgBouncer < 1.22 would also hit this.
   
   Should we consider:
   1. Adding PgBouncer to the integration test matrix (at least for the async 
engine path) to catch regressions across the version combinations?
   2. Setting `prepare_threshold=None` as the safe default in `settings.py` for 
the async engine when no explicit `connect_args_async` is configured — making 
the "no extra configuration" claim actually hold for all versions?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to