pg_analytics
pg_analytics · Postgres for analytics, powered by DuckDB
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 2420 | pg_analytics | pg_analytics | 0.3.7 | OLAP | PostgreSQL | Rust |
PostgreSQL · 14, 15, 16, 17
Usage
Sources:
- Official README for version 0.3.7
- Extension control file
- Version 0.3.7 Rust manifest
- SQL-visible helper APIs
pg_analytics 0.3.7 embeds DuckDB in PostgreSQL and exposes object-store files and data-lake formats through read-only FDWs. ParadeDB discontinued and archived this project in March 2025; it receives no maintenance and should be treated as a legacy integration.
Core Workflow
For hook-based query pushdown in every backend, upstream recommends adding the library to postgresql.conf and restarting PostgreSQL before creating the extension:
Create a format-specific wrapper, server, and foreign table. An empty column list asks the extension to discover the Parquet schema:
Credentials and object-store settings belong in a user mapping rather than the table definition. For S3-compatible storage, relevant mapping options include the credential values plus type, region, endpoint, use_ssl, and url_style as required by the endpoint.
Main Objects
- FDW handler/validator pairs are provided for
csv,json,parquet,delta,iceberg, andspatialsources. - Foreign-table option
filesidentifies local paths, HTTP URLs, object-store URLs, or format-specific table locations. sniff_csvreports detected CSV settings and columns.parquet_describeandparquet_schemainspect Parquet relations.duckdb_executeruns a statement on the embedded DuckDB connection;duckdb_settingsandduckdb_extensionsexpose its state.
Version 0.3.7 embeds DuckDB 1.1.0 and advertises PostgreSQL 13+ support. Upstream lists Parquet, CSV, JSON, geospatial files, Delta Lake, and Apache Iceberg, with local filesystems, HTTP, S3-compatible stores, Google Cloud Storage, Azure storage, and Hugging Face as sources.
Operational Boundaries
The FDWs are read-only. Filesystem access and outbound requests occur from the PostgreSQL server process, and DuckDB query execution shares backend resources with transactional workloads. Restrict function execution, user mappings, file paths, and remote endpoints; do not expose duckdb_execute to untrusted roles.
Adding shared_preload_libraries requires a restart. The archived project documents no Windows support and no future compatibility fixes. Pin the exact 0.3.7 build, test planner pushdown and type conversion on the target PostgreSQL release, and plan migration to a maintained design rather than adopting it for new production systems.