#postgresql #pool #tokio #async

qp-postgres

Quick Pool: High Performance Async Generic Pool PostgreSQL Adapter

2 releases

0.1.1 Jan 9, 2022
0.1.0 Dec 6, 2021

#2627 in Database interfaces

MIT license

24KB
367 lines

Quick Pool for PostgreSQL

High Performance Async Generic Pool PostgreSQL Adapter

Crates.io Docs.rs Rust Rust GitHub Workflow Crates.io License

Usage

Example

Simple Query

use tokio_postgres::NoTls;

#[tokio::main]
async fn main() {
    let config = "postgresql://postgres:postgres@localhost".parse().unwrap();
    let pool = qp_postgres::connect(config, NoTls, 8);
    let client = pool.acquire().await.unwrap();
    let row = client.query_one("SELECT 1", &[]).await.unwrap();
    let int: i32 = row.get(0);
    dbg!(&int);
}

Web Frameworks

Alternatives

Backend Adapter Version
tokio-postgres bb8-postgres bb8-postgres-version
tokio-postgres deadpool-postgres deadpool-postgres-version
tokio-postgres mobc-postgres mobc-postgres-version
postgres r2d2-postgres r2d2-postgres-version
sqlx - sqlx-version

Performance Comparison

PostgreSQL Total Query Time Benchmark

Benchmark

Benchmark

For more information, see Rust Pool Benchmark.

License

Copyright (c) 2022 Seungjae Park

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Quick Pool for PostgreSQL is licensed under the MIT License.

Dependencies

~7–16MB
~222K SLoC