Github   Telegram
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
storages::postgres::CommandControl Struct Reference

#include <userver/storages/postgres/options.hpp>

Public Member Functions

constexpr CommandControl (TimeoutDuration execute, TimeoutDuration statement)
 
constexpr CommandControl WithExecuteTimeout (TimeoutDuration n) const noexcept
 
constexpr CommandControl WithStatementTimeout (TimeoutDuration s) const noexcept
 
bool operator== (const CommandControl &rhs) const
 
bool operator!= (const CommandControl &rhs) const
 

Public Attributes

TimeoutDuration execute {}
 Overall timeout for a command being executed. More...
 
TimeoutDuration statement {}
 PostgreSQL server-side timeout. More...
 

Detailed Description

A structure to control timeouts for PosrgreSQL queries

There are two parameters, execute and statement.

execute parameter controls the overall time the driver spends executing a query, that includes:

statement is rather straightforward, it's the PostgreSQL server-side parameter, and it controls the time the database backend can spend executing a single statement. It is very costly to change the statement timeout often, as it requires a roundtrip to the database to change the setting.

See also
https://www.postgresql.org/docs/12/runtime-config-client.html

execute timeout should always be greater than the statement timeout!

In case of a timeout, either back-end or overall, the client gets an exception and the driver tries to clean up the connection for further reuse.

Examples
postgresql/functional_tests/basic_chaos/postgres_service.cpp.

Definition at line 110 of file options.hpp.

Constructor & Destructor Documentation

◆ CommandControl()

constexpr storages::postgres::CommandControl::CommandControl ( TimeoutDuration  execute,
TimeoutDuration  statement 
)
inlineconstexpr

Definition at line 116 of file options.hpp.

Member Function Documentation

◆ operator!=()

bool storages::postgres::CommandControl::operator!= ( const CommandControl rhs) const
inline

Definition at line 133 of file options.hpp.

◆ operator==()

bool storages::postgres::CommandControl::operator== ( const CommandControl rhs) const
inline

Definition at line 129 of file options.hpp.

◆ WithExecuteTimeout()

constexpr CommandControl storages::postgres::CommandControl::WithExecuteTimeout ( TimeoutDuration  n) const
inlineconstexprnoexcept

Definition at line 119 of file options.hpp.

◆ WithStatementTimeout()

constexpr CommandControl storages::postgres::CommandControl::WithStatementTimeout ( TimeoutDuration  s) const
inlineconstexprnoexcept

Definition at line 124 of file options.hpp.

Member Data Documentation

◆ execute

TimeoutDuration storages::postgres::CommandControl::execute {}

Overall timeout for a command being executed.

Definition at line 112 of file options.hpp.

◆ statement

TimeoutDuration storages::postgres::CommandControl::statement {}

PostgreSQL server-side timeout.

Definition at line 114 of file options.hpp.


The documentation for this struct was generated from the following file: