Skip to content
pg_lake

pg_lake

pg_lake : Data lake extension by Snowflake

Overview

ID Extension Package Version Category License Language
2560
pg_lake
pg_lake
3.4
OLAP
Apache-2.0
C
Attribute Has Binary Has Library Need Load Has DDL Relocatable Trusted
--sLd--
Yes
Yes
Yes
Yes
no
no
Relationships
Schemas lake pg_catalog
Requires
pg_lake_copy
pg_lake_table
See Also
duckdb_fdw
pg_duckdb
pg_ducklake
pg_mooncake
pg_parquet
Siblings
pg_extension_base
pg_extension_updater
pg_map
pg_lake_engine
pg_lake_iceberg
pg_lake_table
pg_lake_copy

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.

Packages

Type Repo Version PG Major Compatibility Package Pattern Dependencies
EXT
PIGSTY
3.4
18
17
16
15
14
pg_lake pg_lake_copy, pg_lake_table
RPM
PIGSTY
3.4.0
18
17
16
15
14
pg_lake_$v -
DEB
PIGSTY
3.4.0
18
17
16
15
14
postgresql-$v-pg-lake -
Linux / PG PG18 PG17 PG16 PG15 PG14
el8.x86_64
N/A
N/A
N/A
N/A
N/A
el8.aarch64
N/A
N/A
N/A
N/A
N/A
el9.x86_64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
el9.aarch64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
el10.x86_64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
el10.aarch64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
d12.x86_64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
d12.aarch64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
d13.x86_64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
d13.aarch64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
u22.x86_64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
u22.aarch64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
u24.x86_64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
u24.aarch64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
u26.x86_64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
u26.aarch64
PIGSTY 3.4.0
PIGSTY 3.4.0
PIGSTY 3.4.0
N/A
N/A
Package Version OS ORG SIZE File URL
pg_lake_18 3.4.0 el9.x86_64 pigsty 19.8 MiB pg_lake_18-3.4.0-2PIGSTY.el9.x86_64.rpm
pg_lake_18 3.4.0 el9.aarch64 pigsty 18.2 MiB pg_lake_18-3.4.0-2PIGSTY.el9.aarch64.rpm
pg_lake_18 3.4.0 el10.x86_64 pigsty 19.2 MiB pg_lake_18-3.4.0-2PIGSTY.el10.x86_64.rpm
pg_lake_18 3.4.0 el10.aarch64 pigsty 17.4 MiB pg_lake_18-3.4.0-2PIGSTY.el10.aarch64.rpm
postgresql-18-pg-lake 3.4.0 d12.x86_64 pigsty 19.0 MiB postgresql-18-pg-lake_3.4.0-2PIGSTY~bookworm_amd64.deb
postgresql-18-pg-lake 3.4.0 d12.aarch64 pigsty 16.8 MiB postgresql-18-pg-lake_3.4.0-2PIGSTY~bookworm_arm64.deb
postgresql-18-pg-lake 3.4.0 d13.x86_64 pigsty 20.0 MiB postgresql-18-pg-lake_3.4.0-2PIGSTY~trixie_amd64.deb
postgresql-18-pg-lake 3.4.0 d13.aarch64 pigsty 17.6 MiB postgresql-18-pg-lake_3.4.0-2PIGSTY~trixie_arm64.deb
postgresql-18-pg-lake 3.4.0 u22.x86_64 pigsty 19.4 MiB postgresql-18-pg-lake_3.4.0-2PIGSTY~jammy_amd64.deb
postgresql-18-pg-lake 3.4.0 u22.aarch64 pigsty 18.1 MiB postgresql-18-pg-lake_3.4.0-2PIGSTY~jammy_arm64.deb
postgresql-18-pg-lake 3.4.0 u24.x86_64 pigsty 19.5 MiB postgresql-18-pg-lake_3.4.0-2PIGSTY~noble_amd64.deb
postgresql-18-pg-lake 3.4.0 u24.aarch64 pigsty 18.2 MiB postgresql-18-pg-lake_3.4.0-2PIGSTY~noble_arm64.deb
postgresql-18-pg-lake 3.4.0 u26.x86_64 pigsty 20.0 MiB postgresql-18-pg-lake_3.4.0-2PIGSTY~resolute_amd64.deb
postgresql-18-pg-lake 3.4.0 u26.aarch64 pigsty 18.9 MiB postgresql-18-pg-lake_3.4.0-2PIGSTY~resolute_arm64.deb

Source

pig build pkg pg_lake;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_lake;		# install via package name, for the active PG version

pig install pg_lake -v 18;   # install for PG 18
pig install pg_lake -v 17;   # install for PG 17
pig install pg_lake -v 16;   # install for PG 16

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_extension_base';

Create this extension with:

CREATE EXTENSION pg_lake CASCADE; -- requires pg_lake_copy, pg_lake_table

Usage

Sources:

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 and lake.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: COPY interception for object-store files and lake formats.
  • pg_lake_engine: shared query rewrite, type conversion, cleanup, and pgduck_server client layer.
  • pg_extension_base: preload and lifecycle-worker infrastructure.
  • pg_map: generated PostgreSQL map types used for nested lake data.

Operational Caveats

  • pgduck_server is 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 VACUUM to 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.
Last updated on