perf(query): optimize result loading and connection reuse

This commit is contained in:
miracle authored and GitHub committed 2026-07-12 11:18:52 +08:00
1 parent 24c63b6012
commit 16e879e40e
27 files changed
+476 -56

No files matched your search

+7 -1
View File
@@ -985,7 +985,13 @@ pub async fn connect(url: &str, fallback_timeout: Duration) -> Result<Pool, Stri
let pg_config = tokio_postgres::Config::from_str(&postgres_url.url)
.map_err(|e| format!("Invalid PostgreSQL connection URL: {e}"))?;
let mgr_config = ManagerConfig { recycling_method: RecyclingMethod::Verified };
// Fast recycling only checks whether the connection is already closed
// instead of issuing a validation query on every checkout, saving one
// round-trip per query. Connections that went stale without being
// observed are caught when the query runs and recovered by the
// executor's ReconnectAndRetry path (see pool_error_action / do_execute
// in query.rs).
let mgr_config = ManagerConfig { recycling_method: RecyclingMethod::Fast };
let tls_config = postgres_tls_config(
&pg_config,
&postgres_url.ssl_files,