Skip to content

gfs

Planner-hook copy-on-read PostgreSQL clones backed by foreign tables.

gfs · Planner-hook copy-on-read PostgreSQL clones backed by foreign tables.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
101375gfsgfs0.0.1ETLMITRust

PostgreSQL · 14, 15, 16, 17, 18

Relationships
Requirespostgres_fdw dblink

Usage

Sources:

gfs uses a planner hook for lazy logical copies of a remote PostgreSQL database. The current Rust module retains extension version 0.0.1 inside GFS distribution 0.5.6. The old C table-access-method implementation in c-ref/ is reference code, not the current interface. Cargo provides PostgreSQL 14–18 features.

Enablement and Routing

A superuser installs the non-relocatable extension and its runtime prerequisites:

CREATE EXTENSION postgres_fdw;
CREATE EXTENSION dblink;
CREATE EXTENSION gfs;

Enable session_preload_libraries = 'gfs' for the clone database and reconnect, preserving existing entries. CREATE EXTENSION alone does not install the planner hook in subsequent sessions. The GFS bootstrap prepares ordinary local tables plus postgres_fdw foreign tables and user mappings; parallel hydration and source diagnostics use dblink. Keep connection credentials in restricted mappings.

Register a prepared local/foreign table pair with gfs.register_clone(local, source_ref, key_col). Integer key ranges hydrate missing ranges; selective predicates can hydrate a bounded slice; unbounded joins and aggregates can be redirected to foreign tables. Fully cached tables serve locally. gfs.warm(local, p_freeze, p_conn) materializes a table; gfs.unregister_clone removes registration. Ordinary remote reads are not a frozen point-in-time database snapshot.

Administration

gfs.clone_source, gfs.cached, gfs.cached_predicate and gfs.clones expose routing/cache state. gfs.calibrate measures source-link weights; gfs.cost sets policies and gfs.budget throttles source contacts. The current SQL also provides source drift checks, gfs.pull, resynchronization and explicit freeze helpers; review their destructive/overwrite choices before applying them to a diverged clone.

Treat source references, key columns and predicates as administrator-controlled inputs; the planner/SPI path uses unsafe native FFI. The bootstrap can omit foreign keys and generated columns, so it is not an exact physical replica. The README lists unfinished hardening and an outdated test suite; code presence alone does not certify those paths. SQL version remains 0.0.1. Replacing a library does not migrate an old clone: the reviewed source now supplies src/sql/upgrade_0_5_4.sql for explicit legacy-catalog migration. Back up and review it against the clone before running it with matching library files. It creates restricted gfs_definer and gfs_shadow roles, relocates postgres_fdw and dblink into gfs_ext, pins function and remote search paths, revises ownership/privileges and discards old untyped predicate-cache records. These changes can affect callers using old qualified names or permissions. This script is not an ALTER EXTENSION version path.

The native predicate checker restricts accepted typed expressions; it does not make arbitrary administrator SQL safe. Preserve the new role boundaries, foreign-server mappings and restricted search paths when granting application access. Existing correctness and recovery limits still need workload validation.

Distribution 0.5.6

Distribution 0.5.6 adds PostgreSQL 14 and 15 build targets for this extension, alongside 16–18. The independent SQL/control version remains 0.0.1. Choose a library for the actual server major; the new targets do not change the clone consistency, privilege or migration boundaries above.

Table reader