pg_extension
indices · In-database model slicing and inference helper functions for structured data analytics.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100828 | pg_extension | indices | 0.1.0 | RAG | Unknown | Rust |
PostgreSQL · 11, 12, 13, 14, 15
Usage
Sources:
- indices developer guide
- pg_extension control file
- SQL-facing Rust API
- Inference and SPI implementation
- Cargo features and dependencies
pg_extension 0.1.0 is the in-database research component of the indices project. It embeds Python through pyo3 and exposes experimental model-selection, profiling, model initialization, and inference functions. It is tied to the repository’s datasets, Python modules, model artifacts, configuration files, and filesystem layout; it is not a portable general-purpose ML extension.
Repository-Specific Workflow
The control file requires superuser, and the default Cargo features build for PostgreSQL 14 with embedded Python. The developer guide creates the extension only after reproducing its container, Python dependencies, database tables, and absolute /project/... paths:
This example is a reproduction target for the upstream experiment, not a safe template for arbitrary application input.
API Groups
- Model selection:
model_selection,model_selection_workloads,model_selection_trails, and coordinator/filter/refinement helpers. - Profiling and benchmarks:
profiling_filtering_phase,profiling_refinement_phase, and latency benchmark functions. - Inference:
inference,inference_shared,inference_shared_write_once, integer/shared-memory variants, andmodel_init. - Build matrix: Cargo declares PostgreSQL 11–15 features; default is PostgreSQL 14 plus
python.
Security and Correctness Boundaries
The name pg_extension collides with PostgreSQL’s pg_catalog.pg_extension system catalog. Qualify catalog queries explicitly.
Many functions are declared IMMUTABLE PARALLEL SAFE even though they read database tables, load and mutate Python/model state, access files, create fixed-name OS shared memory such as my_shared_memory, write logs, and measure time. Those planner labels do not match the implementation. Do not use these functions in indexes, generated columns, constraints, or parallel production queries without a full audit and corrected volatility/parallel declarations.
Dataset names and a caller-supplied SQL fragment are concatenated into SPI queries. Fixed shared-memory names and unchecked unwrap paths also make concurrent calls unsafe. Treat every argument as administrator-controlled, isolate the experiment from production data, and review filesystem, Python import, native-library, memory, and SQL-injection boundaries before execution.