> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pgrust.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pgrust: Postgres Rewritten in Rust, Faster Than ClickHouse

> Pgrust is a wire-compatible Rust rewrite of PostgreSQL 18.3 that outperforms ClickHouse on analytics and PostgreSQL on OLTP. Learn what makes it different.

Pgrust is a complete, from-scratch rewrite of PostgreSQL 18.3 in Rust. It speaks the same wire protocol, understands the same SQL dialect, and passes the same regression tests - but is built on a fundamentally different architecture that delivers measurable performance gains on both analytical and transactional workloads.

## What is Pgrust?

Pgrust is a drop-in replacement for PostgreSQL at the protocol and SQL level. Any application, client library, or driver that works with Postgres works with Pgrust without modification. Under the hood, everything from the storage engine to the query executor has been rewritten from scratch in Rust.

Key properties at a glance:

* **100% wire-compatible** with PostgreSQL 18.3 - use any Postgres client, driver, or tool
* **SQL-dialect-compatible** - the same queries that run on Postgres run on Pgrust
* **Passes all 46,066 tests** in PostgreSQL's own regression suite
* **Measurably faster** than both PostgreSQL and ClickHouse on standard benchmarks

<Warning>
  Pgrust is currently at **v0.2** and is not yet production-ready. Do not use it to store data you cannot afford to lose. It is intended for evaluation, benchmarking, and experimentation.
</Warning>

## Key Capabilities

<CardGroup cols={2}>
  <Card title="Columnar Storage" icon="table-columns">
    **pgrcolumnar** is built directly into Pgrust, providing columnar storage for analytical workloads. No extension installation required — just create a columnar table and start querying.
  </Card>

  <Card title="Vectorized JIT Executor" icon="bolt">
    Pgrust uses a vectorized, push-based, JIT-compiled query executor with approximately **5 µs compile time**, dramatically reducing per-query overhead for both OLTP and analytics.
  </Card>

  <Card title="Thread-Based Concurrency" icon="microchip">
    Rather than spawning a new OS process per connection (as PostgreSQL does), Pgrust uses a **thread-based model**. This reduces memory overhead and improves resource sharing across concurrent connections.
  </Card>

  <Card title="Built-in Query Scheduler" icon="calendar-clock">
    Pgrust includes an integrated **query scheduler** that manages workload prioritization and resource allocation, alongside a built-in **OOM killer** that terminates runaway queries before they crash the server.
  </Card>

  <Card title="Pipelined fsync" icon="hard-drive">
    Pgrust's pipelined fsync implementation delivers a **30–50× speedup** on update-contended queries by optimizing the order of disk flush operations.
  </Card>

  <Card title="Docker Drop-In" icon="docker">
    The `malisper/pgrust:v0.2` image is a **drop-in replacement** for the official `postgres` Docker image. It accepts the same environment variables and supports both `amd64` and `arm64` architectures.
  </Card>
</CardGroup>

## Performance Highlights

Pgrust is benchmarked against industry-standard suites. These results reflect v0.2 on identical hardware.

### ClickBench

[Pgrust with pgrcolumnar columnar storage is **18.5% faster than ClickHouse** across the ClickBench suite](https://benchmark.clickhouse.com/#system=+liH|pgrs|gQ\&type=-\&machine=-6t|ca2|6ax|g4e|6ale|3al\&cluster_size=-\&opensource=-\&hardware=+c\&tuned=+n\&metric=combined\&queries=-). ClickHouse is one of the fastest dedicated analytical databases available, making this a meaningful result for a system that is simultaneously fully PostgreSQL-compatible.

### sysbench OLTP Read-Only

On the sysbench OLTP read-only benchmark at 300 GB scale, Pgrust delivers **30% higher throughput than PostgreSQL 18.3**. This improvement comes from the combination of the thread-based concurrency model, the JIT executor, and reduced IPC overhead.

<Note>
  Both benchmarks were run on identical hardware under controlled conditions. Your results will vary depending on workload shape, hardware, and configuration. Always benchmark against your own workload before drawing conclusions.
</Note>

## Try It Now

<CardGroup cols={3}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Install and run Pgrust on macOS or Linux in under 5 minutes using the pre-built binary.
  </Card>

  <Card title="Docker" icon="docker" href="/docker">
    Run Pgrust as a Docker container — a drop-in replacement for the official `postgres` image.
  </Card>

  <Card title="Browser Demo" icon="globe" href="https://pgrust.com">
    Try Pgrust instantly in your browser — no installation required. Full Pgrust compiled to WebAssembly.
  </Card>
</CardGroup>
