Skip to content

pg_warren

Versioned graph traversal and computation over PostgreSQL tables

pg_warren · Versioned graph traversal and computation over PostgreSQL tables

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2645pg_warrenpg_warren0.8.0FEATApache-2.0Rust
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-dt-NoYesNoYesnoyes
Relationships
Schemaswarren
Shared cache preload on PG15–16

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY0.8.019 18 17 16 15pg_warren-
RPMPIGSTY0.8.019 18 17 16 15pg_warren_$v-
DEBPIGSTY0.8.019 18 17 16 15postgresql-$v-pg-warren-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
el8.aarch64N/APIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
el9.x86_64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
el9.aarch64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
el10.x86_64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
el10.aarch64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
d12.x86_64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
d12.aarch64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
d13.x86_64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
d13.aarch64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
u22.x86_64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
u22.aarch64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
u24.x86_64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
u24.aarch64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
u26.x86_64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
u26.aarch64PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0PIGSTY 0.8.0
PackageVersionOSORGSIZEFile URL
pg_warren_180.8.0el8.x86_64pigsty3.0 MiBpg_warren_18-0.8.0-1PGSTY.el8.x86_64.rpm
pg_warren_180.8.0el8.aarch64pigsty2.4 MiBpg_warren_18-0.8.0-1PGSTY.el8.aarch64.rpm
pg_warren_180.8.0el9.x86_64pigsty2.8 MiBpg_warren_18-0.8.0-2PGSTY.el9.x86_64.rpm
pg_warren_180.8.0el9.aarch64pigsty2.6 MiBpg_warren_18-0.8.0-2PGSTY.el9.aarch64.rpm
pg_warren_180.8.0el10.x86_64pigsty2.8 MiBpg_warren_18-0.8.0-2PGSTY.el10.x86_64.rpm
pg_warren_180.8.0el10.aarch64pigsty2.6 MiBpg_warren_18-0.8.0-2PGSTY.el10.aarch64.rpm
postgresql-18-pg-warren0.8.0d12.x86_64pigsty2.1 MiBpostgresql-18-pg-warren_0.8.0-2PGSTY~bookworm_amd64.deb
postgresql-18-pg-warren0.8.0d12.aarch64pigsty1.7 MiBpostgresql-18-pg-warren_0.8.0-2PGSTY~bookworm_arm64.deb
postgresql-18-pg-warren0.8.0d13.x86_64pigsty2.1 MiBpostgresql-18-pg-warren_0.8.0-2PGSTY~trixie_amd64.deb
postgresql-18-pg-warren0.8.0d13.aarch64pigsty1.7 MiBpostgresql-18-pg-warren_0.8.0-2PGSTY~trixie_arm64.deb
postgresql-18-pg-warren0.8.0u22.x86_64pigsty2.2 MiBpostgresql-18-pg-warren_0.8.0-2PGSTY~jammy_amd64.deb
postgresql-18-pg-warren0.8.0u22.aarch64pigsty2.0 MiBpostgresql-18-pg-warren_0.8.0-2PGSTY~jammy_arm64.deb
postgresql-18-pg-warren0.8.0u24.x86_64pigsty2.2 MiBpostgresql-18-pg-warren_0.8.0-2PGSTY~noble_amd64.deb
postgresql-18-pg-warren0.8.0u24.aarch64pigsty2.0 MiBpostgresql-18-pg-warren_0.8.0-2PGSTY~noble_arm64.deb
postgresql-18-pg-warren0.8.0u26.x86_64pigsty2.2 MiBpostgresql-18-pg-warren_0.8.0-2PGSTY~resolute_amd64.deb
postgresql-18-pg-warren0.8.0u26.aarch64pigsty2.0 MiBpostgresql-18-pg-warren_0.8.0-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_warren_170.8.0el8.x86_64pigsty3.0 MiBpg_warren_17-0.8.0-1PGSTY.el8.x86_64.rpm
pg_warren_170.8.0el8.aarch64pigsty2.4 MiBpg_warren_17-0.8.0-1PGSTY.el8.aarch64.rpm
pg_warren_170.8.0el9.x86_64pigsty2.8 MiBpg_warren_17-0.8.0-2PGSTY.el9.x86_64.rpm
pg_warren_170.8.0el9.aarch64pigsty2.6 MiBpg_warren_17-0.8.0-2PGSTY.el9.aarch64.rpm
pg_warren_170.8.0el10.x86_64pigsty2.8 MiBpg_warren_17-0.8.0-2PGSTY.el10.x86_64.rpm
pg_warren_170.8.0el10.aarch64pigsty2.6 MiBpg_warren_17-0.8.0-2PGSTY.el10.aarch64.rpm
postgresql-17-pg-warren0.8.0d12.x86_64pigsty2.1 MiBpostgresql-17-pg-warren_0.8.0-2PGSTY~bookworm_amd64.deb
postgresql-17-pg-warren0.8.0d12.aarch64pigsty1.7 MiBpostgresql-17-pg-warren_0.8.0-2PGSTY~bookworm_arm64.deb
postgresql-17-pg-warren0.8.0d13.x86_64pigsty2.1 MiBpostgresql-17-pg-warren_0.8.0-2PGSTY~trixie_amd64.deb
postgresql-17-pg-warren0.8.0d13.aarch64pigsty1.7 MiBpostgresql-17-pg-warren_0.8.0-2PGSTY~trixie_arm64.deb
postgresql-17-pg-warren0.8.0u22.x86_64pigsty2.2 MiBpostgresql-17-pg-warren_0.8.0-2PGSTY~jammy_amd64.deb
postgresql-17-pg-warren0.8.0u22.aarch64pigsty2.0 MiBpostgresql-17-pg-warren_0.8.0-2PGSTY~jammy_arm64.deb
postgresql-17-pg-warren0.8.0u24.x86_64pigsty2.2 MiBpostgresql-17-pg-warren_0.8.0-2PGSTY~noble_amd64.deb
postgresql-17-pg-warren0.8.0u24.aarch64pigsty2.0 MiBpostgresql-17-pg-warren_0.8.0-2PGSTY~noble_arm64.deb
postgresql-17-pg-warren0.8.0u26.x86_64pigsty2.2 MiBpostgresql-17-pg-warren_0.8.0-2PGSTY~resolute_amd64.deb
postgresql-17-pg-warren0.8.0u26.aarch64pigsty2.0 MiBpostgresql-17-pg-warren_0.8.0-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_warren_160.8.0el8.x86_64pigsty3.0 MiBpg_warren_16-0.8.0-1PGSTY.el8.x86_64.rpm
pg_warren_160.8.0el8.aarch64pigsty2.4 MiBpg_warren_16-0.8.0-1PGSTY.el8.aarch64.rpm
pg_warren_160.8.0el9.x86_64pigsty2.8 MiBpg_warren_16-0.8.0-2PGSTY.el9.x86_64.rpm
pg_warren_160.8.0el9.aarch64pigsty2.6 MiBpg_warren_16-0.8.0-2PGSTY.el9.aarch64.rpm
pg_warren_160.8.0el10.x86_64pigsty2.8 MiBpg_warren_16-0.8.0-2PGSTY.el10.x86_64.rpm
pg_warren_160.8.0el10.aarch64pigsty2.6 MiBpg_warren_16-0.8.0-2PGSTY.el10.aarch64.rpm
postgresql-16-pg-warren0.8.0d12.x86_64pigsty2.1 MiBpostgresql-16-pg-warren_0.8.0-2PGSTY~bookworm_amd64.deb
postgresql-16-pg-warren0.8.0d12.aarch64pigsty1.7 MiBpostgresql-16-pg-warren_0.8.0-2PGSTY~bookworm_arm64.deb
postgresql-16-pg-warren0.8.0d13.x86_64pigsty2.1 MiBpostgresql-16-pg-warren_0.8.0-2PGSTY~trixie_amd64.deb
postgresql-16-pg-warren0.8.0d13.aarch64pigsty1.7 MiBpostgresql-16-pg-warren_0.8.0-2PGSTY~trixie_arm64.deb
postgresql-16-pg-warren0.8.0u22.x86_64pigsty2.2 MiBpostgresql-16-pg-warren_0.8.0-2PGSTY~jammy_amd64.deb
postgresql-16-pg-warren0.8.0u22.aarch64pigsty2.0 MiBpostgresql-16-pg-warren_0.8.0-2PGSTY~jammy_arm64.deb
postgresql-16-pg-warren0.8.0u24.x86_64pigsty2.2 MiBpostgresql-16-pg-warren_0.8.0-2PGSTY~noble_amd64.deb
postgresql-16-pg-warren0.8.0u24.aarch64pigsty2.0 MiBpostgresql-16-pg-warren_0.8.0-2PGSTY~noble_arm64.deb
postgresql-16-pg-warren0.8.0u26.x86_64pigsty2.2 MiBpostgresql-16-pg-warren_0.8.0-2PGSTY~resolute_amd64.deb
postgresql-16-pg-warren0.8.0u26.aarch64pigsty2.0 MiBpostgresql-16-pg-warren_0.8.0-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_warren_150.8.0el8.x86_64pigsty3.0 MiBpg_warren_15-0.8.0-1PGSTY.el8.x86_64.rpm
pg_warren_150.8.0el8.aarch64pigsty2.4 MiBpg_warren_15-0.8.0-1PGSTY.el8.aarch64.rpm
pg_warren_150.8.0el9.x86_64pigsty2.8 MiBpg_warren_15-0.8.0-2PGSTY.el9.x86_64.rpm
pg_warren_150.8.0el9.aarch64pigsty2.5 MiBpg_warren_15-0.8.0-2PGSTY.el9.aarch64.rpm
pg_warren_150.8.0el10.x86_64pigsty2.8 MiBpg_warren_15-0.8.0-2PGSTY.el10.x86_64.rpm
pg_warren_150.8.0el10.aarch64pigsty2.5 MiBpg_warren_15-0.8.0-2PGSTY.el10.aarch64.rpm
postgresql-15-pg-warren0.8.0d12.x86_64pigsty2.1 MiBpostgresql-15-pg-warren_0.8.0-2PGSTY~bookworm_amd64.deb
postgresql-15-pg-warren0.8.0d12.aarch64pigsty1.7 MiBpostgresql-15-pg-warren_0.8.0-2PGSTY~bookworm_arm64.deb
postgresql-15-pg-warren0.8.0d13.x86_64pigsty2.1 MiBpostgresql-15-pg-warren_0.8.0-2PGSTY~trixie_amd64.deb
postgresql-15-pg-warren0.8.0d13.aarch64pigsty1.7 MiBpostgresql-15-pg-warren_0.8.0-2PGSTY~trixie_arm64.deb
postgresql-15-pg-warren0.8.0u22.x86_64pigsty2.2 MiBpostgresql-15-pg-warren_0.8.0-2PGSTY~jammy_amd64.deb
postgresql-15-pg-warren0.8.0u22.aarch64pigsty2.0 MiBpostgresql-15-pg-warren_0.8.0-2PGSTY~jammy_arm64.deb
postgresql-15-pg-warren0.8.0u24.x86_64pigsty2.2 MiBpostgresql-15-pg-warren_0.8.0-2PGSTY~noble_amd64.deb
postgresql-15-pg-warren0.8.0u24.aarch64pigsty2.0 MiBpostgresql-15-pg-warren_0.8.0-2PGSTY~noble_arm64.deb
postgresql-15-pg-warren0.8.0u26.x86_64pigsty2.2 MiBpostgresql-15-pg-warren_0.8.0-2PGSTY~resolute_amd64.deb
postgresql-15-pg-warren0.8.0u26.aarch64pigsty2.0 MiBpostgresql-15-pg-warren_0.8.0-2PGSTY~resolute_arm64.deb

Source

pig build pkg pg_warren;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_warren;		# install by package name

pig install pg_warren -v 19;   # install for PG 19
pig install pg_warren -v 18;   # install for PG 18
pig install pg_warren -v 17;   # install for PG 17
pig install pg_warren -v 16;   # install for PG 16
pig install pg_warren -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION pg_warren;

Usage

Sources:

pg_warren 0.8.0 builds versioned adjacency snapshots from ordinary PostgreSQL tables for graph traversal and computation. It supports PostgreSQL 15–18 and keeps graph versions, vectors and their changes within PostgreSQL transactions. Traversal reads a built snapshot; source-table changes require an explicit refresh.

Core Workflow

This is a trusted extension: a role with CREATE privilege on the database can install it. A basic graph needs node and edge queries:

CREATE EXTENSION pg_warren;
CREATE TABLE people (id bigint PRIMARY KEY, name text);
CREATE TABLE follows (src bigint, dst bigint);
INSERT INTO people VALUES (1, 'Ada'), (2, 'Bob'), (3, 'Cy');
INSERT INTO follows VALUES (1, 2), (2, 3);
SELECT warren.create_graph('social',
  'SELECT id FROM public.people', 'SELECT src, dst FROM public.follows');
SELECT warren.refresh('social');
SELECT * FROM warren.bfs('social', ARRAY[1::bigint], 3);
SELECT warren.pagerank('social', 'rank');
SELECT * FROM warren.vector_topk('social', 'rank', 3, NULL::bigint);

The graph stores its source queries. Run warren.refresh after changing the source tables; use warren.info to inspect versions and warren.diff to compare them. Building and promoting versions rolls back with the surrounding transaction.

Traversal and Computation

InterfacePurpose
warren.bfs, warren.shortest_pathBreadth-first traversal and shortest paths
warren.pagerank, warren.componentsRank nodes and find connected components
warren.leidenDetect communities
warren.spmv, warren.gatherCompose graph calculations with SQL
warren.vector_topkRead the largest values from a stored vector
warren.shared_cache, warren.backendsInspect shared entries and backend cache usage

Identifier types must agree with the graph. Functions without a node identifier argument may require a type witness such as NULL::bigint. In 0.8.0, PageRank and Leiden use native kernels; they write their results to named vectors.

Memory and Preload

PostgreSQL 17–18 initialize the shared cache on first use. PostgreSQL 15–16 need the following setting and a server restart to share graph data between backends:

shared_preload_libraries = 'pg_warren'

Without preload on PostgreSQL 15–16, graph operations still work using private backend caches. Add the library to any existing preload list.

warren.shared_cache_memory limits the cluster-wide shared cache and takes effect on configuration reload. warren.max_cache_memory, warren.max_compute_memory and warren.max_build_memory limit distinct private-cache, computation and build allocations; they are not one combined memory budget. warren.threads controls computation parallelism. On Linux, shared entries also need sufficient /dev/shm; entries that do not fit fall back to private caches.

Access, Backups and Upgrades

Source queries run as the graph owner with the stored search_path. Use schema-qualified source objects and controlled schemas. Public functions enforce graph access; installation does not grant direct access to private catalog tables.

Dump as a superuser to include graph catalogs, versions and vectors, and restore the required owner/reader roles first. Rebuilding from source tables does not preserve historical graph versions. After installing newer library files, run ALTER EXTENSION pg_warren UPDATE in each database using the extension. Dropping it removes stored graphs. The project remains pre-1.0 and does not maintain graph snapshots incrementally.

Table reader