ashb commented on code in PR #67800:
URL: https://github.com/apache/airflow/pull/67800#discussion_r3355543233
##########
airflow-core/docs/howto/set-up-database.rst:
##########
@@ -233,6 +233,13 @@ For more information regarding setup of the PostgreSQL
connection, see `PostgreS
See also :ref:`Helm Chart production guide <production-guide:pgbouncer>`
+ Some Airflow database routes use an async engine (the Execution API, for
example). The asyncpg
Review Comment:
Sounds good to me.
Huh, that's a bigger difference than I was expecting. I wonder if those
benchmark differences translate to use in Airflow when it's not running the
same query in a loop (just thinking out loud, not asking you to test)
Fwiw you don't need the "uuid prep statement name":
```python
# Two settings needed for pgbouncer transaction-pool compatibility:
# - statement_cache_size=0 (connect_arg → asyncpg.connect): makes
asyncpg use anonymous
# prepared statements (empty name) instead of named ones like
__asyncpg_stmt_N__.
# Anonymous statements don't accumulate on pgbouncer backend
connections.
# - prepared_statement_cache_size=0 (URL param → SQLAlchemy dialect):
prevents SQLAlchemy
# from caching the asyncpg PreparedStatement objects. Anonymous
statements are ephemeral
# (PostgreSQL's unnamed slot is overwritten by each new query), so
cached handles go stale.
query["prepared_statement_cache_size"] = "0"
connect_args["statement_cache_size"] = 0
url = url.set(drivername="postgresql+asyncpg",
query=immutabledict(query))
```
worked and was enough for me in my testing
--
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]