Skip to content

pg_ducklake

DuckLake lakehouse extension for PostgreSQL, backed by DuckDB and Parquet

pg_ducklake · DuckLake lakehouse extension for PostgreSQL, backed by DuckDB and Parquet

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2490pg_ducklakepg_ducklake1.0.3OLAPMITC++
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd--NoYesYesYesnono

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY1.0.319 18 17 16 15pg_ducklake-
RPMPIGSTY1.0.319 18 17 16 15pg_ducklake_$v-
DEBPIGSTY1.0.319 18 17 16 15postgresql-$v-pg-ducklake-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/AN/AN/AN/AN/A
el8.aarch64N/AN/AN/AN/AN/A
el9.x86_64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
el9.aarch64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
el10.x86_64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
el10.aarch64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
d12.x86_64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
d12.aarch64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
d13.x86_64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
d13.aarch64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
u22.x86_64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
u22.aarch64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
u24.x86_64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
u24.aarch64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
u26.x86_64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
u26.aarch64N/APIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3PIGSTY 1.0.3
PackageVersionOSORGSIZEFile URL
pg_ducklake_181.0.3el9.x86_64pigsty14.3 MiBpg_ducklake_18-1.0.3-2PGSTY.el9.x86_64.rpm
pg_ducklake_181.0.3el9.aarch64pigsty13.1 MiBpg_ducklake_18-1.0.3-2PGSTY.el9.aarch64.rpm
pg_ducklake_181.0.3el10.x86_64pigsty15.4 MiBpg_ducklake_18-1.0.3-2PGSTY.el10.x86_64.rpm
pg_ducklake_181.0.3el10.aarch64pigsty13.8 MiBpg_ducklake_18-1.0.3-2PGSTY.el10.aarch64.rpm
postgresql-18-pg-ducklake1.0.3d12.x86_64pigsty14.6 MiBpostgresql-18-pg-ducklake_1.0.3-2PGSTY~bookworm_amd64.deb
postgresql-18-pg-ducklake1.0.3d12.aarch64pigsty12.7 MiBpostgresql-18-pg-ducklake_1.0.3-2PGSTY~bookworm_arm64.deb
postgresql-18-pg-ducklake1.0.3d13.x86_64pigsty15.6 MiBpostgresql-18-pg-ducklake_1.0.3-2PGSTY~trixie_amd64.deb
postgresql-18-pg-ducklake1.0.3d13.aarch64pigsty13.5 MiBpostgresql-18-pg-ducklake_1.0.3-2PGSTY~trixie_arm64.deb
postgresql-18-pg-ducklake1.0.3u22.x86_64pigsty16.1 MiBpostgresql-18-pg-ducklake_1.0.3-2PGSTY~jammy_amd64.deb
postgresql-18-pg-ducklake1.0.3u22.aarch64pigsty14.8 MiBpostgresql-18-pg-ducklake_1.0.3-2PGSTY~jammy_arm64.deb
postgresql-18-pg-ducklake1.0.3u24.x86_64pigsty16.3 MiBpostgresql-18-pg-ducklake_1.0.3-2PGSTY~noble_amd64.deb
postgresql-18-pg-ducklake1.0.3u24.aarch64pigsty15.2 MiBpostgresql-18-pg-ducklake_1.0.3-2PGSTY~noble_arm64.deb
postgresql-18-pg-ducklake1.0.3u26.x86_64pigsty17.0 MiBpostgresql-18-pg-ducklake_1.0.3-2PGSTY~resolute_amd64.deb
postgresql-18-pg-ducklake1.0.3u26.aarch64pigsty16.0 MiBpostgresql-18-pg-ducklake_1.0.3-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_ducklake_171.0.3el9.x86_64pigsty14.3 MiBpg_ducklake_17-1.0.3-2PGSTY.el9.x86_64.rpm
pg_ducklake_171.0.3el9.aarch64pigsty13.1 MiBpg_ducklake_17-1.0.3-2PGSTY.el9.aarch64.rpm
pg_ducklake_171.0.3el10.x86_64pigsty15.4 MiBpg_ducklake_17-1.0.3-2PGSTY.el10.x86_64.rpm
pg_ducklake_171.0.3el10.aarch64pigsty13.8 MiBpg_ducklake_17-1.0.3-2PGSTY.el10.aarch64.rpm
postgresql-17-pg-ducklake1.0.3d12.x86_64pigsty14.6 MiBpostgresql-17-pg-ducklake_1.0.3-2PGSTY~bookworm_amd64.deb
postgresql-17-pg-ducklake1.0.3d12.aarch64pigsty12.7 MiBpostgresql-17-pg-ducklake_1.0.3-2PGSTY~bookworm_arm64.deb
postgresql-17-pg-ducklake1.0.3d13.x86_64pigsty15.6 MiBpostgresql-17-pg-ducklake_1.0.3-2PGSTY~trixie_amd64.deb
postgresql-17-pg-ducklake1.0.3d13.aarch64pigsty13.5 MiBpostgresql-17-pg-ducklake_1.0.3-2PGSTY~trixie_arm64.deb
postgresql-17-pg-ducklake1.0.3u22.x86_64pigsty16.5 MiBpostgresql-17-pg-ducklake_1.0.3-2PGSTY~jammy_amd64.deb
postgresql-17-pg-ducklake1.0.3u22.aarch64pigsty15.2 MiBpostgresql-17-pg-ducklake_1.0.3-2PGSTY~jammy_arm64.deb
postgresql-17-pg-ducklake1.0.3u24.x86_64pigsty16.3 MiBpostgresql-17-pg-ducklake_1.0.3-2PGSTY~noble_amd64.deb
postgresql-17-pg-ducklake1.0.3u24.aarch64pigsty15.2 MiBpostgresql-17-pg-ducklake_1.0.3-2PGSTY~noble_arm64.deb
postgresql-17-pg-ducklake1.0.3u26.x86_64pigsty16.9 MiBpostgresql-17-pg-ducklake_1.0.3-2PGSTY~resolute_amd64.deb
postgresql-17-pg-ducklake1.0.3u26.aarch64pigsty16.0 MiBpostgresql-17-pg-ducklake_1.0.3-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_ducklake_161.0.3el9.x86_64pigsty14.3 MiBpg_ducklake_16-1.0.3-2PGSTY.el9.x86_64.rpm
pg_ducklake_161.0.3el9.aarch64pigsty13.0 MiBpg_ducklake_16-1.0.3-2PGSTY.el9.aarch64.rpm
pg_ducklake_161.0.3el10.x86_64pigsty15.4 MiBpg_ducklake_16-1.0.3-2PGSTY.el10.x86_64.rpm
pg_ducklake_161.0.3el10.aarch64pigsty13.8 MiBpg_ducklake_16-1.0.3-2PGSTY.el10.aarch64.rpm
postgresql-16-pg-ducklake1.0.3d12.x86_64pigsty14.6 MiBpostgresql-16-pg-ducklake_1.0.3-2PGSTY~bookworm_amd64.deb
postgresql-16-pg-ducklake1.0.3d12.aarch64pigsty12.7 MiBpostgresql-16-pg-ducklake_1.0.3-2PGSTY~bookworm_arm64.deb
postgresql-16-pg-ducklake1.0.3d13.x86_64pigsty15.6 MiBpostgresql-16-pg-ducklake_1.0.3-2PGSTY~trixie_amd64.deb
postgresql-16-pg-ducklake1.0.3d13.aarch64pigsty13.5 MiBpostgresql-16-pg-ducklake_1.0.3-2PGSTY~trixie_arm64.deb
postgresql-16-pg-ducklake1.0.3u22.x86_64pigsty16.5 MiBpostgresql-16-pg-ducklake_1.0.3-2PGSTY~jammy_amd64.deb
postgresql-16-pg-ducklake1.0.3u22.aarch64pigsty15.2 MiBpostgresql-16-pg-ducklake_1.0.3-2PGSTY~jammy_arm64.deb
postgresql-16-pg-ducklake1.0.3u24.x86_64pigsty16.3 MiBpostgresql-16-pg-ducklake_1.0.3-2PGSTY~noble_amd64.deb
postgresql-16-pg-ducklake1.0.3u24.aarch64pigsty15.2 MiBpostgresql-16-pg-ducklake_1.0.3-2PGSTY~noble_arm64.deb
postgresql-16-pg-ducklake1.0.3u26.x86_64pigsty16.9 MiBpostgresql-16-pg-ducklake_1.0.3-2PGSTY~resolute_amd64.deb
postgresql-16-pg-ducklake1.0.3u26.aarch64pigsty16.0 MiBpostgresql-16-pg-ducklake_1.0.3-2PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_ducklake_151.0.3el9.x86_64pigsty14.4 MiBpg_ducklake_15-1.0.3-2PGSTY.el9.x86_64.rpm
pg_ducklake_151.0.3el9.aarch64pigsty13.1 MiBpg_ducklake_15-1.0.3-2PGSTY.el9.aarch64.rpm
pg_ducklake_151.0.3el10.x86_64pigsty15.5 MiBpg_ducklake_15-1.0.3-2PGSTY.el10.x86_64.rpm
pg_ducklake_151.0.3el10.aarch64pigsty13.8 MiBpg_ducklake_15-1.0.3-2PGSTY.el10.aarch64.rpm
postgresql-15-pg-ducklake1.0.3d12.x86_64pigsty14.6 MiBpostgresql-15-pg-ducklake_1.0.3-2PGSTY~bookworm_amd64.deb
postgresql-15-pg-ducklake1.0.3d12.aarch64pigsty12.7 MiBpostgresql-15-pg-ducklake_1.0.3-2PGSTY~bookworm_arm64.deb
postgresql-15-pg-ducklake1.0.3d13.x86_64pigsty15.6 MiBpostgresql-15-pg-ducklake_1.0.3-2PGSTY~trixie_amd64.deb
postgresql-15-pg-ducklake1.0.3d13.aarch64pigsty13.5 MiBpostgresql-15-pg-ducklake_1.0.3-2PGSTY~trixie_arm64.deb
postgresql-15-pg-ducklake1.0.3u22.x86_64pigsty16.5 MiBpostgresql-15-pg-ducklake_1.0.3-2PGSTY~jammy_amd64.deb
postgresql-15-pg-ducklake1.0.3u22.aarch64pigsty15.2 MiBpostgresql-15-pg-ducklake_1.0.3-2PGSTY~jammy_arm64.deb
postgresql-15-pg-ducklake1.0.3u24.x86_64pigsty16.3 MiBpostgresql-15-pg-ducklake_1.0.3-2PGSTY~noble_amd64.deb
postgresql-15-pg-ducklake1.0.3u24.aarch64pigsty15.2 MiBpostgresql-15-pg-ducklake_1.0.3-2PGSTY~noble_arm64.deb
postgresql-15-pg-ducklake1.0.3u26.x86_64pigsty16.9 MiBpostgresql-15-pg-ducklake_1.0.3-2PGSTY~resolute_amd64.deb
postgresql-15-pg-ducklake1.0.3u26.aarch64pigsty16.0 MiBpostgresql-15-pg-ducklake_1.0.3-2PGSTY~resolute_arm64.deb

Source

pig build pkg pg_ducklake;		# 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_ducklake;		# install by package name

pig install pg_ducklake -v 18;   # install for PG 18
pig install pg_ducklake -v 17;   # install for PG 17
pig install pg_ducklake -v 16;   # install for PG 16
pig install pg_ducklake -v 15;   # install for PG 15

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_ducklake';

Create this extension with:

CREATE EXTENSION pg_ducklake;

Usage

Sources:

pg_ducklake adds DuckLake tables to PostgreSQL. DuckLake metadata lives in PostgreSQL while table data is stored in Parquet and queried through DuckDB, giving PostgreSQL SQL clients access to lakehouse features such as snapshots, time travel, partitioning, sort keys, and external object storage.

Create A DuckLake Table

CREATE EXTENSION pg_ducklake;

CREATE TABLE events (
  id int,
  kind text,
  ts timestamptz
) USING ducklake;

INSERT INTO events VALUES
  (1, 'login', now()),
  (2, 'click', now());

SELECT * FROM events ORDER BY id;

Set a table path explicitly when data should live outside the default path:

CREATE TABLE lake_events (
  id int,
  payload jsonb
) WITH (
  ducklake.table_path = 's3://my-bucket/prefix/'
) USING ducklake;

Time Travel

Each commit creates a snapshot. Capture a snapshot id before a change, then query the older state:

SELECT max(snapshot_id) AS before_delete
FROM ducklake.ducklake_snapshot \gset

DELETE FROM events WHERE id = 1;

SELECT * FROM ducklake.time_travel('events'::regclass, :before_delete);

Convert And Load Data

Create DuckLake tables from existing PostgreSQL heap tables or external data readers:

CREATE TABLE row_store AS
SELECT i AS id, 'hello pg_ducklake' AS msg
FROM generate_series(1, 10000) AS i;

CREATE TABLE col_store USING ducklake AS
SELECT * FROM row_store;

CREATE TABLE titanic USING ducklake AS
SELECT * FROM ducklake.read_csv('https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv');

Inlining, Partitioning, And Maintenance

Small writes are inlined in metadata by default to avoid creating many tiny Parquet files. Tune the row limit or flush explicitly:

CALL ducklake.set_option('data_inlining_row_limit', 100);
SELECT * FROM ducklake.flush_inlined_data('events'::regclass);

Partition and sort tables for pruning and analytics:

CALL ducklake.set_partition('events'::regclass, 'bucket(4, id)', 'month(ts)');
CREATE INDEX ON events USING ducklake_sorted (id, ts);

Run maintenance on demand when automatic background maintenance is not enough:

SELECT * FROM ducklake.merge_adjacent_files('events'::regclass);
CALL ducklake.set_option('expire_older_than', '7 days');
SELECT * FROM ducklake.expire_snapshots();
SELECT * FROM ducklake.cleanup_old_files();

External DuckDB Access

DuckDB clients can attach the same DuckLake metadata:

INSTALL ducklake;
LOAD ducklake;
ATTACH 'ducklake:postgres:dbname=postgres host=localhost' AS my_ducklake
  (METADATA_SCHEMA 'ducklake');

SELECT * FROM my_ducklake.public.events;

Caveats

  • Version 1.0.0 supports PostgreSQL 14-18.
  • The README lists Ubuntu 22.04-24.04 and macOS as source-build targets.
  • Cloud credentials are stored through a ducklake_secret foreign server and per-user mappings; protect those catalog objects like other database secrets.
  • For incremental heap-to-DuckLake conversion, upstream points to the separate pg_duckpipe project.

1.0.3 Correctness and Snapshot Fixes

Version 1.0.3 fixes auto_explain interactions that could fail queries, execute INSERT twice or crash, and fixes filtering and joins on non-C text collations plus pruning of real columns. Background maintenance retains replaced files until delete_older_than permits deletion, protecting older readers. Direct inserts and COPY FROM STDIN now preserve numeric/array values and update column statistics correctly. Re-running a secret helper replaces a secret of the same type and scope, rather than leaving a duplicate that shadows new credentials.

Table reader