MCPcopy Index your code
hub / github.com/JagritGumber/evolvsql

github.com/JagritGumber/evolvsql @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
783 symbols 3,231 edges 169 files 198 documented · 25%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

EvolvSQL

This project is in early development and highly unstable. APIs, storage format, and wire protocol behavior will change without notice. Do not use in production. Contributions and feedback welcome — just know that everything is actively being reworked.

PostgreSQL-compatible database built on BEAM + Rust.

Same SQL. Same drivers. 100x less memory per connection.


Why

PostgreSQL forks an OS process for every connection — 14.6 MB each, even idle. 50 idle connections cost 729 MB. This architecture hasn't changed since 1986.

EvolvSQL replaces the process-per-connection model with BEAM lightweight processes (~2 KB active, 0 KB hibernated) and a Rust query engine for parsing and execution.

PostgreSQL 17 EvolvSQL
Per idle connection 14.6 MB 0 KB (hibernated)
Per active connection 14.6 MB ~15 KB
50 connections overhead +729 MB +768 KB
Connection model fork() per conn BEAM process
MVCC Dead tuples + VACUUM Undo-log (planned)
Cold start 0 ms 0 ms

Architecture

Client (psql, any PG driver)
  → BEAM process (2 KB per connection, supervised)
    → Rust NIF (parse + execute via pg_query)
      → Shared storage (RwLock, no per-connection duplication)

BEAM handles connections, wire protocol, fault tolerance, and clustering. Rust handles SQL parsing (via pg_query — same parser PostgreSQL uses), expression evaluation, JOINs, and storage.

What Works

  • Wire Protocol v3 — psql connects without changes
  • SQL — JOINs (INNER, LEFT, RIGHT, FULL, CROSS), subqueries (IN, EXISTS, scalar, derived), aggregates (COUNT, SUM, AVG, MIN, MAX), GROUP BY, HAVING, ORDER BY, LIMIT, OFFSET
  • DML — INSERT, UPDATE, DELETE with RETURNING
  • DDL — CREATE TABLE, DROP TABLE, SERIAL, DEFAULT, constraints (PK, UNIQUE, NOT NULL)
  • Types — int2/4/8, float4/8, numeric, bool, text, varchar, bytea, serial, vector(N)
  • Vectorvector(N) type with <-> (L2), <=> (cosine), <#> (inner product) operators — pgvector wire-compatible
  • Protocol — Simple query, extended query, prepared statements
  • Connection — Hibernation (0 KB idle), built-in pooling via BEAM
  • Tests — 97 engine tests passing

Quick Start

# Clone
git clone https://github.com/JagritGumber/evolvsql.git
cd evolvsql

# Dependencies: Elixir ~1.18, OTP 27, Rust (2024 edition)
mix deps.get

# Build the Rust NIF
cd native/engine && cargo build --release && cd ../..

# Start EvolvSQL
mix run --no-halt

# Connect with psql (default port 5432)
psql -h localhost -p 5432 -U postgres

Roadmap

Phase Status What
Wire protocol + basic CRUD Done psql connects, INSERT/SELECT/UPDATE/DELETE
JOINs + aggregates Done All JOIN types, GROUP BY, HAVING, ORDER BY
Subqueries Done IN, EXISTS, scalar, derived tables
Connection hibernation Done 0 KB idle connections
Vector type (pgvector compat) Done vector(N), distance operators
Persistent storage Next B-tree indexes, WAL, crash recovery
ACID transactions Planned BEGIN/COMMIT/ROLLBACK, isolation levels
Undo-log MVCC Planned Zero bloat, no VACUUM
BEAM clustering Planned Multi-node distribution

See FEATURES.md for the complete specification.

Benchmarks

Memory: 50 idle connections

PostgreSQL 17 EvolvSQL
Additional memory +729 MB +0 KB
Per connection 14.6 MB 0 KB (hibernated)

Query throughput

EvolvSQL achieves 2x the query throughput of PostgreSQL on equivalent hardware in initial benchmarks.

License

Business Source License 1.1 — the same license used by CockroachDB.

  • Use EvolvSQL for anything, including commercial production use
  • Self-host freely
  • Cannot offer EvolvSQL as a managed database service

Converts to AGPL-3.0 five years after each version's release.

Links

Core symbols most depended-on inside this repo

execute
called by 1108
native/engine/src/executor/mod.rs
reset
called by 249
native/engine/src/catalog.rs
disable
called by 116
native/engine/src/wal/manager/lifecycle.rs
eval_expr
called by 55
native/engine/src/executor/expr.rs
enable
called by 52
native/engine/src/wal/manager/lifecycle.rs
is_null
called by 50
native/engine/src/arena.rs
recover
called by 46
native/engine/src/wal/recovery/mod.rs
insert
called by 38
native/engine/src/hnsw.rs

Shape

Function 661
Method 74
Class 37
Enum 11

Languages

Rust100%

Modules by API surface

native/engine/src/storage.rs43 symbols
native/engine/src/arena.rs33 symbols
native/engine/src/hnsw.rs24 symbols
native/engine/src/catalog.rs22 symbols
native/engine/src/types.rs15 symbols
native/cli/src/wire.rs15 symbols
native/engine/src/window.rs13 symbols
native/engine/src/sequence.rs12 symbols
native/engine/src/parser.rs11 symbols
native/engine/src/executor/types.rs11 symbols
native/engine/src/wal/writer.rs10 symbols
native/engine/src/wal/manager/ops.rs10 symbols

For agents

$ claude mcp add evolvsql \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact