pg_hydradb
pg-hydradb · Transactional graph traversal over registered PostgreSQL vertex and edge tables.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102358 | pg_hydradb | pg-hydradb | 0.1.0 | FEAT | Elastic-2.0 | Rust |
PostgreSQL · 16, 17, 18
Usage
Sources:
pg_hydradb 0.1.0, included in HydraDB distribution 0.4.0, traverses graphs registered over ordinary PostgreSQL vertex and edge tables. Triggers maintain internal adjacency data in the same database. It supports PostgreSQL 16–18; it does not expose the separate HydraDB server’s entire query surface.
Register and Traverse
A superuser installs the non-relocatable extension into its fixed hydradb schema. In a fresh database, register tables with non-null integer, text or UUID keys, primary/unique constraints and edge-to-vertex foreign keys:
hydradb.reachable_edges returns reached edges; hydradb.paths_from returns paths from seeds. Options include max_depth, direction, edge_kind, edge_kinds and paths_per_pair. Results use registered labels and keys. Query functions check source-table access; a caller subject to RLS is refused rather than receiving a filtered graph. Use a table owner or a role that legitimately bypasses RLS.
Maintenance and Recovery
Run hydradb.create_graph, hydradb.refresh_graph and hydradb.drop_graph at READ COMMITTED. Views, partitioned tables and inheritance are unsupported. Relevant destructive DDL is refused; rewrites, missing triggers, missing foreign keys or text keys over 2,000 bytes can mark a graph as needing refresh. Correct the cause, then run hydradb.refresh_graph. Source data and extension adjacency/configuration data must both be included in backups.
The documented upgrade path drops each graph, runs DROP EXTENSION pg_hydradb without CASCADE, installs matching files, recreates the extension and registers graphs again. REPEATABLE READ writers may receive SQLSTATE 40001 after a refresh and must retry.
Optional Preload and Telemetry
Queries work without preload. Adding pg_hydradb to the existing shared preload list and restarting enables shared activity counters and an hourly usage-report worker. Reporting is on by default and includes a stable cluster-derived install ID, versions, rounded counts and usage/error histograms; the upstream contract excludes query text, identifiers, keys and results. hydradb.usage_report() shows the current database report.
Set pg_hydradb.usage_report = off and reload to disable reporting. Re-enabling requires a restart. pg_hydradb.usage_report_url and pg_hydradb.usage_report_interval control the endpoint and interval. Without preload, nothing is sent and activity counters are unavailable. The source is licensed under Elastic-2.0; review its deployment restrictions.