age

age : AGE graph database extension

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2700
age
age
1.7.0
FEAT
Apache-2.0
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd--
No
Yes
Yes
Yes
no
no
Relationships
Schemasag_catalog
See Also
pg_graphql
rum
pg_jsonschema
jsquery
ltree
http
pg_net
citus

pg18/17 = 1.7.0

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
MIXED
1.7.0
18
17
16
15
14
age-
RPM
PIGSTY
1.7.0
18
17
16
15
14
apache-age_$v-
DEB
PGDG
1.7.0
18
17
16
15
14
postgresql-$v-age-
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.6.0
PIGSTY 1.6.0
PIGSTY 1.6.0
el8.aarch64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.6.0
PIGSTY 1.6.0
PIGSTY 1.6.0
el9.x86_64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.6.0
PIGSTY 1.6.0
PIGSTY 1.6.0
el9.aarch64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.6.0
PIGSTY 1.6.0
PIGSTY 1.6.0
el10.x86_64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.6.0
PIGSTY 1.6.0
PIGSTY 1.6.0
el10.aarch64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.6.0
PIGSTY 1.6.0
PIGSTY 1.6.0
d12.x86_64
PIGSTY 1.7.0
PIGSTY 1.7.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
d12.aarch64
PIGSTY 1.7.0
PIGSTY 1.7.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
d13.x86_64
PIGSTY 1.7.0
PIGSTY 1.7.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
d13.aarch64
PIGSTY 1.7.0
PIGSTY 1.7.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
u22.x86_64
PIGSTY 1.7.0
PIGSTY 1.7.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
u22.aarch64
PIGSTY 1.7.0
PIGSTY 1.7.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
u24.x86_64
PIGSTY 1.7.0
PIGSTY 1.7.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
u24.aarch64
PIGSTY 1.7.0
PIGSTY 1.7.0
PGDG 1.6.0
PGDG 1.6.0
PGDG 1.6.0
PackageVersionOSORGSIZEFile URL
apache-age_181.7.0el8.x86_64pigsty247.6 KiBapache-age_18-1.7.0-2PIGSTY.el8.x86_64.rpm
apache-age_181.7.0el8.aarch64pigsty229.8 KiBapache-age_18-1.7.0-2PIGSTY.el8.aarch64.rpm
apache-age_181.7.0el9.x86_64pigsty229.2 KiBapache-age_18-1.7.0-2PIGSTY.el9.x86_64.rpm
apache-age_181.7.0el9.aarch64pigsty220.1 KiBapache-age_18-1.7.0-2PIGSTY.el9.aarch64.rpm
apache-age_181.7.0el10.x86_64pigsty231.6 KiBapache-age_18-1.7.0-2PIGSTY.el10.x86_64.rpm
apache-age_181.7.0el10.aarch64pigsty221.8 KiBapache-age_18-1.7.0-2PIGSTY.el10.aarch64.rpm
postgresql-18-age1.7.0d12.x86_64pigsty683.1 KiBpostgresql-18-age_1.7.0-1PIGSTY~bookworm_amd64.deb
postgresql-18-age1.7.0d12.x86_64pgdg680.5 KiBpostgresql-18-age_1.7.0~rc0-1.pgdg12+1_amd64.deb
postgresql-18-age1.7.0d12.aarch64pigsty662.7 KiBpostgresql-18-age_1.7.0-1PIGSTY~bookworm_arm64.deb
postgresql-18-age1.7.0d12.aarch64pgdg661.4 KiBpostgresql-18-age_1.7.0~rc0-1.pgdg12+1_arm64.deb
postgresql-18-age1.7.0d13.x86_64pigsty683.3 KiBpostgresql-18-age_1.7.0-1PIGSTY~trixie_amd64.deb
postgresql-18-age1.7.0d13.x86_64pgdg682.3 KiBpostgresql-18-age_1.7.0~rc0-1.pgdg13+1_amd64.deb
postgresql-18-age1.7.0d13.aarch64pigsty664.1 KiBpostgresql-18-age_1.7.0-1PIGSTY~trixie_arm64.deb
postgresql-18-age1.7.0d13.aarch64pgdg662.7 KiBpostgresql-18-age_1.7.0~rc0-1.pgdg13+1_arm64.deb
postgresql-18-age1.7.0u22.x86_64pigsty763.1 KiBpostgresql-18-age_1.7.0-1PIGSTY~jammy_amd64.deb
postgresql-18-age1.7.0u22.x86_64pgdg702.8 KiBpostgresql-18-age_1.7.0~rc0-1.pgdg22.04+1_amd64.deb
postgresql-18-age1.7.0u22.aarch64pigsty753.5 KiBpostgresql-18-age_1.7.0-1PIGSTY~jammy_arm64.deb
postgresql-18-age1.7.0u22.aarch64pgdg682.6 KiBpostgresql-18-age_1.7.0~rc0-1.pgdg22.04+1_arm64.deb
postgresql-18-age1.7.0u24.x86_64pigsty727.1 KiBpostgresql-18-age_1.7.0-1PIGSTY~noble_amd64.deb
postgresql-18-age1.7.0u24.x86_64pgdg681.4 KiBpostgresql-18-age_1.7.0~rc0-1.pgdg24.04+1_amd64.deb
postgresql-18-age1.7.0u24.aarch64pigsty717.0 KiBpostgresql-18-age_1.7.0-1PIGSTY~noble_arm64.deb
postgresql-18-age1.7.0u24.aarch64pgdg660.4 KiBpostgresql-18-age_1.7.0~rc0-1.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
apache-age_171.7.0el8.x86_64pigsty247.8 KiBapache-age_17-1.7.0-2PIGSTY.el8.x86_64.rpm
apache-age_171.7.0el8.aarch64pigsty229.9 KiBapache-age_17-1.7.0-2PIGSTY.el8.aarch64.rpm
apache-age_171.7.0el9.x86_64pigsty229.2 KiBapache-age_17-1.7.0-2PIGSTY.el9.x86_64.rpm
apache-age_171.7.0el9.aarch64pigsty220.5 KiBapache-age_17-1.7.0-2PIGSTY.el9.aarch64.rpm
apache-age_171.7.0el10.x86_64pigsty231.7 KiBapache-age_17-1.7.0-2PIGSTY.el10.x86_64.rpm
apache-age_171.7.0el10.aarch64pigsty222.0 KiBapache-age_17-1.7.0-2PIGSTY.el10.aarch64.rpm
postgresql-17-age1.7.0d12.x86_64pigsty683.2 KiBpostgresql-17-age_1.7.0-1PIGSTY~bookworm_amd64.deb
postgresql-17-age1.7.0d12.x86_64pgdg680.8 KiBpostgresql-17-age_1.7.0~rc0-1.pgdg12+1_amd64.deb
postgresql-17-age1.7.0d12.aarch64pigsty661.5 KiBpostgresql-17-age_1.7.0-1PIGSTY~bookworm_arm64.deb
postgresql-17-age1.7.0d12.aarch64pgdg660.8 KiBpostgresql-17-age_1.7.0~rc0-1.pgdg12+1_arm64.deb
postgresql-17-age1.7.0d13.x86_64pigsty683.6 KiBpostgresql-17-age_1.7.0-1PIGSTY~trixie_amd64.deb
postgresql-17-age1.7.0d13.x86_64pgdg681.8 KiBpostgresql-17-age_1.7.0~rc0-1.pgdg13+1_amd64.deb
postgresql-17-age1.7.0d13.aarch64pigsty664.3 KiBpostgresql-17-age_1.7.0-1PIGSTY~trixie_arm64.deb
postgresql-17-age1.7.0d13.aarch64pgdg661.9 KiBpostgresql-17-age_1.7.0~rc0-1.pgdg13+1_arm64.deb
postgresql-17-age1.7.0u22.x86_64pigsty863.0 KiBpostgresql-17-age_1.7.0-1PIGSTY~jammy_amd64.deb
postgresql-17-age1.7.0u22.x86_64pgdg800.3 KiBpostgresql-17-age_1.7.0~rc0-1.pgdg22.04+1_amd64.deb
postgresql-17-age1.7.0u22.aarch64pigsty854.5 KiBpostgresql-17-age_1.7.0-1PIGSTY~jammy_arm64.deb
postgresql-17-age1.7.0u22.aarch64pgdg778.6 KiBpostgresql-17-age_1.7.0~rc0-1.pgdg22.04+1_arm64.deb
postgresql-17-age1.7.0u24.x86_64pigsty733.4 KiBpostgresql-17-age_1.7.0-1PIGSTY~noble_amd64.deb
postgresql-17-age1.7.0u24.x86_64pgdg680.8 KiBpostgresql-17-age_1.7.0~rc0-1.pgdg24.04+1_amd64.deb
postgresql-17-age1.7.0u24.aarch64pigsty717.3 KiBpostgresql-17-age_1.7.0-1PIGSTY~noble_arm64.deb
postgresql-17-age1.7.0u24.aarch64pgdg660.7 KiBpostgresql-17-age_1.7.0~rc0-1.pgdg24.04+1_arm64.deb

Source

pig build pkg age;		# 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 age;		# install via package name, for the active PG version

pig install age -v 18;   # install for PG 18
pig install age -v 17;   # install for PG 17
pig install age -v 16;   # install for PG 16
pig install age -v 15;   # install for PG 15
pig install age -v 14;   # install for PG 14

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'age';

Create this extension with:

CREATE EXTENSION age;

Usage

age: AGE graph database extension

Apache AGE brings graph database capabilities to PostgreSQL using the openCypher query language. It enables hybrid querying that combines SQL and Cypher, property indexes on vertices and edges, and the ability to query multiple graphs.

Each session requires loading the extension:

CREATE EXTENSION age;
LOAD 'age';
SET search_path = ag_catalog, "$user", public;

Graph Operations

Create a graph:

SELECT create_graph('my_graph');

Create vertices:

SELECT * FROM cypher('my_graph', $$
    CREATE (:Person {name: 'Alice', age: 30})
$$) AS (v agtype);

SELECT * FROM cypher('my_graph', $$
    CREATE (:Person {name: 'Bob', age: 25})
$$) AS (v agtype);

Create edges:

SELECT * FROM cypher('my_graph', $$
    MATCH (a:Person), (b:Person)
    WHERE a.name = 'Alice' AND b.name = 'Bob'
    CREATE (a)-[e:KNOWS {since: 2020}]->(b)
    RETURN e
$$) AS (e agtype);

Query the graph:

SELECT * FROM cypher('my_graph', $$
    MATCH (v)-[r]-(v2)
    RETURN v, r, v2
$$) AS (v agtype, r agtype, v2 agtype);

Cypher Query Features

AGE supports standard Cypher clauses including MATCH, CREATE, SET, DELETE, RETURN, WITH, WHERE, ORDER BY, SKIP, and LIMIT. Data is stored using the agtype data type, which extends JSON with graph-specific types for vertices, edges, and paths.

Pattern matching with variable-length paths:

SELECT * FROM cypher('my_graph', $$
    MATCH (a:Person)-[:KNOWS*1..3]->(b:Person)
    RETURN a.name, b.name
$$) AS (source agtype, target agtype);

Hybrid SQL/Cypher queries allow joining graph results with relational tables:

SELECT t.*, c.* FROM my_table t
JOIN cypher('my_graph', $$
    MATCH (n:Person) RETURN n.name, id(n)
$$) AS c(name agtype, id agtype)
ON t.graph_id = c.id;
Last updated on