Replies: 2 comments 4 replies
-
These queries are somewhat required to ensure that the connection is actually working. At least that's the only safe way I'm aware of to check whether the connection is actually usable. If someone knows a better way of handling that please comment here.
As far as I understand that documentation
It is already somewhat configurable as you technically could just provide your own connection manager that implements That written: I might be open to accept a similar interface to that one exported by |
Beta Was this translation helpful? Give feedback.
-
I think the only way to get it working via that approach is by implementing |
Beta Was this translation helpful? Give feedback.
-
Currently, diesel-async does a "SELECT 1" query for every connection released back to the pool:
diesel_async/src/pooled_connection/deadpool.rs
Line 84 in b95650f
diesel_async/src/pooled_connection/mod.rs
Lines 235 to 236 in b95650f
While benchmarking lemmy, when counting the queries run with
pg_stat_statements
, this "SELECT 1" query doubles the number of queries run in total (in 2 minutes, 2 million application queries are run and another 2 million "SELECT 1" queries. 48% of all queries run are the ping() calls. Now these queries have a mean execution time of 0.02ms, and I don't know how relevant their impact is, but still.In deadpool_postgres, the recycling method is configurable: https://docs.rs/deadpool-postgres/latest/deadpool_postgres/enum.RecyclingMethod.html And apparently the plan is to move to "fast" recycling by default in the next version, which does not run any query.
Would it be possible to make the recycling method configurable? Or maybe even to use the "normal" deadpool_postgres connection manager? I don't understand exactly how diesel-async and deadpool interact, sorry.
Beta Was this translation helpful? Give feedback.
All reactions