pg_lake
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_lake | 3.4 | OLAP | Apache-2.0 | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 2560 | pg_lake | Yes | Yes | Yes | Yes | No | No | lake |
| 2561 | pg_extension_base | No | Yes | Yes | Yes | No | No | extension_base |
| 2562 | pg_extension_updater | No | Yes | Yes | Yes | No | No | extension_updater |
| 2563 | pg_map | No | Yes | No | Yes | No | No | map_type |
| 2564 | pg_lake_engine | No | Yes | Yes | Yes | No | No | __lake__internal__nsp__ |
| 2565 | pg_lake_iceberg | No | Yes | No | Yes | No | No | lake_iceberg |
| 2566 | pg_lake_table | No | Yes | Yes | Yes | No | No | __pg_lake_table_writes |
| 2567 | pg_lake_copy | No | Yes | Yes | Yes | No | No | pg_catalog |
| Related | pg_lake_copy pg_lake_table duckdb_fdw pg_duckdb pg_ducklake pg_mooncake pg_parquet |
|---|
Pigsty packages this release for PG16-18. Configure shared_preload_libraries=pg_extension_base and run the matching PG-major pgduck_server process. RPM supports EL9/EL10 only; EL8 is rejected because OpenSSL 3 is required. DEB supports Debian 12/13 and Ubuntu 22.04/24.04/26.04 on amd64/arm64. DuckDB and Avro are private per PG major. Co-installation with pg_duckdb, pg_mooncake, and duckdb_fdw is file-safe, but overlapping hooks and COPY behavior can be preload-order-sensitive. Extension SQL/control version is 3.4; source and DEB/RPM package version is 3.4.0.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 3.4 | 1817161514 | pg_lake | pg_lake_copy, pg_lake_table |
| RPM | PIGSTY | 3.4.0 | 1817161514 | pg_lake_$v | - |
| DEB | PIGSTY | 3.4.0 | 1817161514 | postgresql-$v-pg-lake | - |
Build
You can build the RPM / DEB packages for pg_lake using pig build:
pig build pkg pg_lake # build RPM / DEB packages
Install
You can install pg_lake directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install pg_lake; # Install for current active PG version
pig ext install -y pg_lake -v 18 # PG 18
pig ext install -y pg_lake -v 17 # PG 17
pig ext install -y pg_lake -v 16 # PG 16
dnf install -y pg_lake_18 # PG 18
dnf install -y pg_lake_17 # PG 17
dnf install -y pg_lake_16 # PG 16
apt install -y postgresql-18-pg-lake # PG 18
apt install -y postgresql-17-pg-lake # PG 17
apt install -y postgresql-16-pg-lake # PG 16
Preload:
shared_preload_libraries = 'pg_extension_base';
Create Extension:
CREATE EXTENSION pg_lake CASCADE; -- requires: pg_lake_copy, pg_lake_table
Usage
Sources:
- Official pg_lake README
- Version 3.4 control file
- Official build and startup guide
- Official project documentation index
pg_lake is the top-level extension for Snowflake’s PostgreSQL lakehouse stack. It installs the table, Iceberg, copy, query-engine, extension-base, and map components needed to query object-store files and create transactional Iceberg tables. The PostgreSQL extensions orchestrate planning and transactions while a separate local pgduck_server process executes vectorized work with DuckDB.
Start the Stack
Version 3.4 supports PostgreSQL 16 through 18. Preload the common extension infrastructure, restart PostgreSQL, and start pgduck_server on the database host:
shared_preload_libraries = 'pg_extension_base'
pgduck_server --cache_dir /var/cache/pg_lake
Create the complete dependency tree in the target database:
CREATE EXTENSION pg_lake CASCADE;
SELECT lake.version();
Configure object-store credentials for pgduck_server, then choose the managed Iceberg location:
SET pg_lake_iceberg.default_location_prefix =
's3://analytics-bucket/warehouse';
Core Workflows
Create and modify a transactional Iceberg table:
CREATE TABLE measurements (
station_name text NOT NULL,
measured_at timestamptz NOT NULL,
value double precision
) USING iceberg;
INSERT INTO measurements VALUES
('Istanbul', now(), 18.5),
('Haarlem', now(), 9.3);
Import or export Parquet, CSV, or newline-delimited JSON through COPY:
COPY (SELECT * FROM measurements)
TO 's3://analytics-bucket/export/measurements.parquet';
COPY measurements
FROM 's3://analytics-bucket/import/measurements.parquet';
Query files without loading them into PostgreSQL:
CREATE FOREIGN TABLE external_events ()
SERVER pg_lake
OPTIONS (path 's3://analytics-bucket/events/*.parquet');
SELECT count(*) FROM external_events;
Component Index
pg_lake: meta-extension andlake.version().pg_lake_table: data-lake FDW, Iceberg table syntax, file utilities, and table catalogs.pg_lake_iceberg: Iceberg metadata, snapshots, manifests, and catalog integration.pg_lake_copy:COPYinterception for object-store files and lake formats.pg_lake_engine: shared query rewrite, type conversion, cleanup, andpgduck_serverclient layer.pg_extension_base: preload and lifecycle-worker infrastructure.pg_map: generated PostgreSQL map types used for nested lake data.
Operational Caveats
pgduck_serveris required for lake queries and must have working object-store credentials and local socket connectivity from PostgreSQL.- S3 and compatible credentials are resolved by the DuckDB secrets/credential chain. Grant only the bucket permissions required by the workload.
- Iceberg writes create Parquet files per statement. Batch inserts and run regular
VACUUMto avoid many small files. - The PostgreSQL extensions,
pgduck_server, object-store data, and Iceberg catalog form one deployment unit. Back up and upgrade them as separate evidence layers; creating the extension alone does not prove the external services are usable.
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.