sqlx icon indicating copy to clipboard operation
sqlx copied to clipboard

improve docs: Transactions can use up connection pool

Open erikschul opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. AFAIK, a connection can only run one transaction. So I conclude that in async, if multiple transactions are running, the connection pool can be fully occupied, which could lead to unexpected/hard-to-debug slowness in a system with a small connection pool that otherwise has good performance.

It may also make sense to recommend explicit rollback rather than relying on Drop. See this. IIUC, the async nature could mean that Drop is delayed, which can cause further slowness. I've not confirmed this though, but it seems plausible.

I suggest that this should be emphasized/documented at: https://docs.rs/sqlx/latest/sqlx/struct.Transaction.html

erikschul avatar Jan 10 '24 20:01 erikschul