Skip to content

pg_feature

SQL feature synthesis across table relationships and time cutoffs.

pg_extensions · SQL feature synthesis across table relationships and time cutoffs.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102093pg_featurepg_extensions0.4.0RAGMatroid-SAL-1.0Rust

PostgreSQL · 14, 15, 16, 17, 18

Usage

Sources:

pg_feature 0.4.0 provides relational feature synthesis in pgft. Register table relationships and time indexes, then produce features using aggregations and temporal cutoffs.

Core Workflow

CREATE EXTENSION pg_feature;
CREATE TABLE feature_events (id bigint PRIMARY KEY, created_at timestamptz, value numeric);
SELECT pgft.set_time_index('feature_events', 'created_at');
SELECT * FROM pgft.synthesize_features(
  'event_features', 'feature_events', 'id',
  cutoff_time => TIMESTAMPTZ '2026-10-01 00:00:00+00', max_depth => 1
);
SELECT * FROM pgft.list_features('event_features');

Operational Boundaries

The control does not require superuser-only installation, but object-creation privileges still apply. No preload or Python runtime is required. set_time_index and add_relationship establish metadata; synthesize_features creates feature outputs, and list_features inspects definitions. Registered timestamps and cutoffs must prevent future-data leakage. Materialized outputs require explicit refresh, and generated SQL/relationships need review before use on large or sensitive tables. This is an unsupported proof of concept under Matroid Source Available License 1.0. APIs may change. Version 0.3.0 is the new upgrade baseline: earlier 0.2.0 installations require a rehearsed data migration/recreation, not ordinary ALTER EXTENSION UPDATE. Back up data and dependencies before following that destructive upstream path.

Consistency Fixes in 0.4.0

Repository release 0.7.3 contains extension 0.4.0, fixing agreement between training matrices and live feature SQL, depth-two computed features, cutoffs and windows. Column counts must retain null semantics rather than becoming counts of all rows. The upgrade preserves stored cutoff intervals without a cascading drop. Validate generated SQL and training/online results against representative data. PostgreSQL features cover 14–18; installations on 0.3.0 or later use matching upgrade files, while earlier versions retain the migration boundary above.

Table reader