pg-uses-jsonb-with-gin-for-dependent-queries
IN premise
PgApi stores antecedents and outlist as JSONB arrays with GIN indexes, enabling per-operation dependent lookups via `@>` containment queries — unlike the SQLite backend which loads the full network, PgApi queries relationships incrementally.
Summary
The PostgreSQL backend uses JSONB columns with GIN indexes to efficiently look up which beliefs depend on a given node, querying only the relevant relationships rather than loading the entire belief network into memory. This means dependent lookups and retraction cascades scale with the number of affected nodes rather than the total network size, which is a key architectural difference from the SQLite backend.
Details
| Source | entries/2026/05/11/reasons_lib-pg.md |