Evokoa/pgGraph

Open-source graph database superpowers for your existing Postgres data.

What it solves

pgGraph solves the performance bottleneck of running graph-style queries (such as finding shortest paths or multi-hop relationships) on standard relational PostgreSQL tables. Instead of relying on complex recursive SQL or expensive joins that slow down as data grows, it provides a high-speed execution layer for graph traversals.

How it works

It functions as a PostgreSQL extension that treats existing tables as the source of truth while building a derived, highly optimized graph index.

  • CSR Adjacency: It compiles relational data into Compressed Sparse Row (CSR) edge stores, allowing for O(1) adjacency lookups and raw memory scans rather than SQL-based relationship discovery.
  • Derived State: The graph is a read-only artifact derived from the tables; PostgreSQL continues to handle storage, WAL, and durability, while pgGraph handles the traversal logic.
  • Safety Mechanisms: To prevent database crashes from unbounded expansion, it implements circuit breakers including depth limits, frontier limits, and memory safeguards.
  • SQL Integration: Users interact with the graph via SQL functions in the graph schema (e.g., graph.search() and graph.shortest_path()) without needing to learn a new query language like Cypher.

Who it’s for

It is designed for developers and database administrators who already use PostgreSQL and need to perform high-performance graph searches or relationship analysis without migrating their data to a dedicated graph database.

Highlights

  • No Data Migration: Works directly on existing PostgreSQL tables without requiring a new schema or storage system.
  • High Performance: Uses CSR memory structures to bypass the overhead of recursive SQL.
  • Standard SQL Interface: Accessible via standard SQL functions rather than a specialized graph query language.
  • Resource Protection: Built-in safeguards like visited-node tracking and OOM protection to ensure database stability.

Related

  • Project
  • Project
  • Project
  • Project
  • Project