fastpg is a fast async PostgreSQL client for Python, written in Rust. It turns rows straight into msgspec Structs, so you get typed objects back with no extra code. On common queries it is about twice as fast as asyncpg, psycopg 3 and psqlpy.
Install
uv add fastpg
Quickstart
import asyncio
import msgspec
import fastpg
class Person(msgspec.Struct):
id: int
name: str
email: str | None
async def main() -> None:
dsn = "postgresql://fastpg:fastpg@127.0.0.1:55432/fastpg"
async with await fastpg.create_pool(dsn) as pool:
query = "SELECT id, name, email FROM people WHERE id = $1"
person = await pool.select_one(query, 42, into=Person)
print(person) # Person(id=42, name='person-42', email=None)
query = "SELECT id, name, email FROM people WHERE id <= $1 ORDER BY id"
people = await pool.select_many(query, 3, into=Person)
print(len(people)) # 3
asyncio.run(main())
Features
- Typed rows. Pass
into=Personand get Structs back. Dicts, NamedTuples and pydantic models work too. - A pool you query directly.
pool.select_one(...)needs noacquire(). - Safe parameters. Use
$1,:nameor Python t-strings. Values are always sent apart from the SQL. - Fast bulk writes.
copy_in,insert_manyandexecute_many. - The rest you need. Transactions, TLS, and clear errors such as
UniqueViolationError. - Fully typed. Checks cleanly with
pyright --strict.
Benchmarks
| workload | fastpg | fastest other driver | speed-up |
|---|---|---|---|
| Primary-key lookup into a Struct, 16 tasks | 39,774/s | 17,144/s (asyncpg) | 2.32x |
| Page of 20 rows into Structs, 16 tasks | 19,002/s | 9,094/s (asyncpg) | 2.09x |
| 1,000 rows into Structs, 4 tasks | 1.03M rows/s | 476k rows/s (asyncpg) | 2.15x |
| Single-row INSERT, 16 tasks | 35,860/s | 16,087/s (asyncpg) | 2.23x |
| Binary COPY, 5,000 rows | 1.16M rows/s | 823k rows/s (psycopg) | 1.41x |
Measured in CI on one shared GitHub runner; the smallest lead, a transaction, is 1.13x (details).
Documentation
fastpg is alpha software. MIT licensed.
Metadata
Release files for fastpg 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fastpg-0.1.0.tar.gz | 165.3 kB | With provenance | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| fastpg-0.1.0-cp314-cp314t-musllinux_1_2_x86_64.whl | CPython 3.14 | CPython 3.14 free-threading | Linux musl 1.2+ x86-64 | Details |
| fastpg-0.1.0-cp314-cp314t-musllinux_1_2_aarch64.whl | CPython 3.14 | CPython 3.14 free-threading | Linux musl 1.2+ ARM64 | Details |
| fastpg-0.1.0-cp314-cp314t-manylinux_2_28_x86_64.whl | CPython 3.14 | CPython 3.14 free-threading | Linux glibc 2.28+ x86-64 | Details |
| fastpg-0.1.0-cp314-cp314t-manylinux_2_28_aarch64.whl | CPython 3.14 | CPython 3.14 free-threading | Linux glibc 2.28+ ARM64 | Details |
| fastpg-0.1.0-cp314-cp314t-macosx_11_0_arm64.whl | CPython 3.14 | CPython 3.14 free-threading | macOS 11.0+ ARM64 | Details |
| fastpg-0.1.0-cp314-cp314t-macosx_10_12_x86_64.whl | CPython 3.14 | CPython 3.14 free-threading | macOS 10.12+ x86-64 | Details |
| fastpg-0.1.0-cp314-cp314-musllinux_1_2_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux musl 1.2+ x86-64 | Details |
| fastpg-0.1.0-cp314-cp314-musllinux_1_2_aarch64.whl | CPython 3.14 | CPython 3.14 | Linux musl 1.2+ ARM64 | Details |
| fastpg-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.28+ x86-64 | Details |
| fastpg-0.1.0-cp314-cp314-manylinux_2_28_aarch64.whl | CPython 3.14 | CPython 3.14 | Linux glibc 2.28+ ARM64 | Details |
| fastpg-0.1.0-cp314-cp314-macosx_11_0_arm64.whl | CPython 3.14 | CPython 3.14 | macOS 11.0+ ARM64 | Details |
| fastpg-0.1.0-cp314-cp314-macosx_10_12_x86_64.whl | CPython 3.14 | CPython 3.14 | macOS 10.12+ x86-64 | Details |
Total release size: 21.7 MB
Release files / fastpg-0.1.0.tar.gz
| Download URL | fastpg-0.1.0.tar.gz |
|---|---|
| Size | 165.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
237b5821f0c423dff7d11390102c3f2ee914a2ef4139a94be3b92b82714909d8
|
|
BLAKE2b-256 checksum How to use checksums |
f5048d49e2be07422f8aef46ee6a1c4d3470fec78ea7544751ecc37d1b72868a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314t-musllinux_1_2_x86_64.whl
| Download URL | fastpg-0.1.0-cp314-cp314t-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
b1283246ca10d0ef60828dae2af49601f6f9f267db9633176d49ca3458af145a
|
|
BLAKE2b-256 checksum How to use checksums |
c9d58a0a5094ae6027b0191abc1178493793edb6b469d54088197e6b5e1d24aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314t-musllinux_1_2_aarch64.whl
| Download URL | fastpg-0.1.0-cp314-cp314t-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
43e4a30ffc6de83d4810d09fef8c39c890dedb2f2dfe15b8c850015721fd7996
|
|
BLAKE2b-256 checksum How to use checksums |
b3b89ed5c8f4ed8b77d2a07f3a4f07df97997c8055af90b2f0e8eaa9c809a9dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314t-manylinux_2_28_x86_64.whl
| Download URL | fastpg-0.1.0-cp314-cp314t-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
c2d1225d435c62edd92bc4267ffd373b1f9ae1befd400d9dcbf0c25be37263be
|
|
BLAKE2b-256 checksum How to use checksums |
39b013da63ed4910471454930153b26d1f8c8c6921c3aaeeb8c4208fbedf72ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314t-manylinux_2_28_aarch64.whl
| Download URL | fastpg-0.1.0-cp314-cp314t-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
56730090ecc18c17b45ee5ff0b9cbcf699c331dd93ff7c34bfc0b1afe3a7a6ce
|
|
BLAKE2b-256 checksum How to use checksums |
a2f5419395d0f5f66fdfdcd748a42a0461794748b85791498ac405e0d5918f6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314t-macosx_11_0_arm64.whl
| Download URL | fastpg-0.1.0-cp314-cp314t-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
ffcdc0dc8a5c4d87fe0797d5d07495ed41ea225250175006d3b5529a9f9f8d2e
|
|
BLAKE2b-256 checksum How to use checksums |
22048403343735932f20c0551be19975cb48341f31388340632ed6da7895c127
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314t-macosx_10_12_x86_64.whl
| Download URL | fastpg-0.1.0-cp314-cp314t-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
a844b701068dc45c44d14eb1b4d7f043625649ba11f02621b21827218e0fce31
|
|
BLAKE2b-256 checksum How to use checksums |
7df432803e3977ab7b975d201e759301f885c25a1d5b4253dfe2e8f63a9bf373
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314-musllinux_1_2_x86_64.whl
| Download URL | fastpg-0.1.0-cp314-cp314-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.14 Linux musl 1.2+ x86-64 |
|
SHA-256 checksum How to use checksums |
4782f8cb6ac6f63a5a216b13774952acbcd1e0cfd2a0e8610e0a5c6dff51121a
|
|
BLAKE2b-256 checksum How to use checksums |
181bdd19027a02ecd9fea8932f6289c50c162308cef3ab603dc74d5d8a00c1b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314-musllinux_1_2_aarch64.whl
| Download URL | fastpg-0.1.0-cp314-cp314-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.14 Linux musl 1.2+ ARM64 |
|
SHA-256 checksum How to use checksums |
eef9b0f9cbed4868e89a6238b9f101cf846082f22ed1a36312906c985c1964c2
|
|
BLAKE2b-256 checksum How to use checksums |
d9ca07598fcb93430554daaf37241b48337f079a42bb9763d3c83d1afa235d0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl
| Download URL | fastpg-0.1.0-cp314-cp314-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.14 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a1687a59b1daf7f0cceb1c941a98993e8ef424c686e7808bf40a4a5cb01a75cb
|
|
BLAKE2b-256 checksum How to use checksums |
b20c016c9f89d3a97272fe4ecc0eeb45f042d84f61bf4e6b8ade30b20b544b10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314-manylinux_2_28_aarch64.whl
| Download URL | fastpg-0.1.0-cp314-cp314-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.14 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
b5292efdbf1e46dec398fb9e6cea150fe8e0590ec8a508a18bcc482ff8d48cdf
|
|
BLAKE2b-256 checksum How to use checksums |
3226a0cb8266b933b1d94992825f0efefe5f28d7598f5a601f2fddd4113e2161
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314-macosx_11_0_arm64.whl
| Download URL | fastpg-0.1.0-cp314-cp314-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.6 MB |
| Tags | CPython 3.14 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
587621102a8113b9400c52062171cb8bcef48e8495883bea66fdf6c52839c3b5
|
|
BLAKE2b-256 checksum How to use checksums |
bc275b4cf527d172c283785e327fb5cddf89a9623166fe6b2d58d09f832d8790
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logRelease files / fastpg-0.1.0-cp314-cp314-macosx_10_12_x86_64.whl
| Download URL | fastpg-0.1.0-cp314-cp314-macosx_10_12_x86_64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.14 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
55cddfa34b296df61eb85f1fcbde85a922ac878e7991b8fd7128025f3b5f7fb6
|
|
BLAKE2b-256 checksum How to use checksums |
d612af2936cf90743208caf22de8e0d1569a599aab3b50107c424769ccf0748e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logSecurity for fastpg 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 13 files in this release have been uploaded with provenance metadata.
Attestation for fastpg-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.