#[non_exhaustive]pub struct PoolConfig {
pub max_connections: u32,
pub min_connections: u32,
pub acquire_timeout: Duration,
pub idle_timeout: Option<Duration>,
pub max_lifetime: Option<Duration>,
pub test_before_acquire: bool,
pub reset_on_recycle: bool,
pub row_buffer_size: u32,
pub full_table_include_limit: Option<u64>,
pub slow_query_threshold: Option<Duration>,
}Expand description
Configuration used to build a Pool.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_connections: u32Maximum connections held open by the pool.
min_connections: u32Connections kept warm while idle.
acquire_timeout: DurationMaximum time spent waiting to acquire a connection.
idle_timeout: Option<Duration>Maximum idle connection duration; None keeps idle connections forever.
max_lifetime: Option<Duration>Maximum connection lifetime; None disables recycling by age.
test_before_acquire: boolWhether to test a connection before handing it out.
Defaults to false to avoid a per-query ping round-trip (or ~10 µs on
SQLite). Set true when connections are killed between checkouts.
reset_on_recycle: boolWhether to reset session state when a connection returns to the pool.
Only meaningful for the native tokio-postgres backend, where it
selects deadpool’s Clean recycling: temp tables, listens, advisory
locks, SET values and any open transaction are discarded on recycle.
Defaults to false because it costs a round trip on every checkout —
measured at roughly 2× the total per-query latency on a local database
— and the driver exists to avoid exactly that. Correctness does not
depend on it: an abandoned transaction is rolled back before its
connection is released. Turn it on as defence in depth when application
code sets session state it does not clean up itself.
row_buffer_size: u32Number of rows the SQLite driver buffers per prepared statement.
This is only meaningful when connect/connect_with build a native
SQLite pool. The default matches sqlx-sqlite’s own default.
full_table_include_limit: Option<u64>Maximum child-table rows that can be loaded in a single batched include
query before the loader falls back to a chunked IN (...) list.
This bounds the full-table fast path so a parent table with millions of
rows does not cause the loader to materialise and decode the entire child
table. None disables fast-path include loading entirely and always uses
chunked IN. Defaults to 100_000.
slow_query_threshold: Option<Duration>Duration above which a query emits a WARN event with the SQL shape and
bind count. None disables slow-query warnings.
This is a process-wide setting; the last connect_with call wins.
Trait Implementations§
Source§impl Clone for PoolConfig
impl Clone for PoolConfig
Source§impl Debug for PoolConfig
impl Debug for PoolConfig
Source§impl Default for PoolConfig
impl Default for PoolConfig
impl Eq for PoolConfig
Source§impl PartialEq for PoolConfig
impl PartialEq for PoolConfig
impl StructuralPartialEq for PoolConfig
Auto Trait Implementations§
impl Freeze for PoolConfig
impl RefUnwindSafe for PoolConfig
impl Send for PoolConfig
impl Sync for PoolConfig
impl Unpin for PoolConfig
impl UnsafeUnpin for PoolConfig
impl UnwindSafe for PoolConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more