userver: uPg Driver
No Matches
uPg Driver

Quality: Platinum Tier.

🐙 userver provides access to PostgreSQL database servers via components::Postgres. The uPg driver is asynchronous, it suspends current coroutine for carrying out network I/O.


  • PostgreSQL cluster topology discovery;
  • Manual cluster sharding (access to shard clusters by index);
  • Connection pooling;
  • Queries are transparently converted to prepared statements to use less network on next execution, give the database more optimization freedom, avoid the need for parameters escaping as the latter are now send separately from the query;
  • Automatic PgaaS topology discovery;
  • Selecting query target (master/slave);
  • Connection failover;
  • Transaction support;
  • Variadic template query parameter passing;
  • Query result extraction to C++ types;
  • More effective binary protocol usage for communication rather than the libpq's text protocol;
  • Caching the low-level database (D)escribe responses to save about a half of network bandwidth on select statements that return multiple columns (compared to the libpq implementation);
  • Portals for effective background cache updates;
  • Queries pipelining to execute multiple queries in one network roundtrip (for example begin + set transaction timeout + insert result in one roundtrip);
  • Ability to manually control network roundtrips via storages::postgres::QueryQueue to gain maximum efficiency in case of multiple unrelated select statements;
  • Mapping PostgreSQL user types to C++ types;
  • Transaction error injection via pytest_userver.sql.RegisteredTrx;
  • LISTEN/NOTIFY support via storages::postgres::Cluster::Listen();
  • Deadline propagation .

More information