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 | pg_ducklake pg_duckdb pg_parquet pg_mooncake duckdb_fdw aws_s3 file_fdw pg_bulkload pg_clickhouse columnar |
| Siblings | pg_extension_base pg_extension_updater pg_map pg_lake_engine pg_lake_iceberg pg_lake_table pg_lake_copy |
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 |
Source
github.com/Snowflake-Labs/pg_lake
pg_lake-3.4.0.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
Sources:
- Official pg_lake README
- Version 3.4 control file
- Official build and startup guide
- Official project documentation index
- DuckDB secrets manager
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 Packaged Stack
Version 3.4 supports PostgreSQL 16 through 18. The PIGSTY RPM and DEB packages install the extension files and a versioned pgduck_server binary, but they do not currently install or auto-start a systemd service. Running CREATE EXTENSION does not start pgduck_server either.
Add pg_extension_base to shared_preload_libraries and restart PostgreSQL:
pgduck_server listens on /tmp/.s.PGSQL.5332 with mode 0770 by default. Run it as the PostgreSQL operating-system user so PostgreSQL can access the socket. Do not start it as an unrelated login user with the bare command.
This command runs in the foreground and must remain running. Use a service supervisor for production. If you use a dedicated service account instead, make it a member of the postgres group and start the server with --unix_socket_group postgres --unix_socket_permissions 0770.
In another terminal, verify the query engine before creating the extensions:
Then create the complete dependency tree in the target database:
Configure Object-Store Access
Object-store credentials are resolved by pgduck_server, not by the PostgreSQL backend. AWS and GCP can use their normal credential chains. For a local S3-compatible endpoint such as MinIO, first create the bucket, connect directly to pgduck_server, and create a persistent DuckDB secret:
Connect to PostgreSQL, then choose the managed Iceberg location in the same session that creates the table:
Core Workflows
Create and modify a transactional Iceberg table:
Import or export Parquet, CSV, or newline-delimited JSON through COPY:
Query files without loading them into PostgreSQL:
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 on every PostgreSQL host that can execute lake queries. Keep it supervised and verify its local socket before serving traffic.- The default socket mode is
0770; its owner and group come from the account that startspgduck_server. A mismatched service user causesERROR: could not start query engine. - S3 and compatible credentials are resolved by the DuckDB secrets/credential chain. Grant only the bucket permissions required by the workload.
- The first start may download the DuckDB spatial extension. Ensure the service account has the required network access and writable state/cache directories.
CREATE PERSISTENT SECRETsurvives server restarts, but DuckDB stores it unencrypted under~/.duckdb/stored_secrets. Keep the service account and its home directory stable, restrict permissions, and protect those files as credentials.- The default memory limit is 80 percent of system memory. Set
--memory_limitexplicitly when PostgreSQL andpgduck_servershare a production host. - 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.