⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

longcipher/pg-ext

Repository files navigation

pg-ext

A PostgreSQL extension toolkit written in Rust, featuring a high-performance Key-Value store and Queue implementation backed by PostgreSQL.

Benchmarks

Benchmarks were conducted on a local macOS environment comparing pg-ext (using Unlogged tables for performance) against a local Redis instance.

Test Environment

  • OS: macOS
  • System: Local Development Machine
  • PostgreSQL: Local instance (Unix domain socket / localhost)
  • Redis: Local instance (127.0.0.1:6379)
  • Tool: Criterion.rs
  • Date: 2024 (Current)

Results Summary

Operation pg-ext (Unlogged) Redis Ratio (Redis / pg-ext)
SET ~11.0k ops/s ~26.7k ops/s ~2.4x
GET ~12.7k ops/s ~27.5k ops/s ~2.2x
INCR (Atomic) ~11.4k ops/s ~25.7k ops/s ~2.2x
MSET (10 items) ~91.7k items/s ~249.1k items/s ~2.7x
MGET (10 items) ~93.9k items/s ~223.1k items/s ~2.4x
RPUSH (Queue) ~10.2k ops/s ~27.0k ops/s ~2.6x
Push/Pop (Roundtrip) ~5.3k ops/s ~12.8k ops/s ~2.4x

Interpretation

pg-ext achieves approximately 40-50% of Redis performance for raw Key-Value operations. Considering pg-ext provides full SQL consistency (tunable) and persists data within PostgreSQL's robust storage engine, these results demonstrate that pg-ext is a viable alternative to Redis for applications already using PostgreSQL, eliminating the need for a separate infrastructure component for caching or simple queueing needs.

Note: pg-ext tests used UNLOGGED tables to approximate cache-like behavior (persistence across restarts, but not crash-safe), which is the closest comparison to default Redis persistence.

Running Benchmarks

  1. Ensure Postgres and Redis are running locally.
  2. Create a database named pgext.
  3. Run the benchmark command:
cargo bench

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published