Skip to content

pg_duckdb

DuckDB Embedded in Postgres

pg_duckdb · DuckDB Embedded in Postgres

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
2430pg_duckdbpg_duckdb1.2.2OLAPMITC++
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--sLd--NoYesYesYesnono
Embeds DuckDB 2.0.1. Preload required. Conflicts with duckdb_fdw.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY1.2.219 18 17 16 15pg_duckdb-
RPMPIGSTY1.2.219 18 17 16 15pg_duckdb_$v-
DEBPIGSTY1.2.219 18 17 16 15postgresql-$v-pg-duckdb-
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
el8.aarch64N/APIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0PIGSTY 1.2.0
el9.x86_64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
el9.aarch64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
el10.x86_64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
el10.aarch64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
d12.x86_64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
d12.aarch64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
d13.x86_64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
d13.aarch64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
u22.x86_64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
u22.aarch64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
u24.x86_64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
u24.aarch64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
u26.x86_64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
u26.aarch64PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2PIGSTY 1.2.2
PackageVersionOSORGSIZEFile URL
pg_duckdb_191.2.2el9.x86_64pigsty32.2 MiBpg_duckdb_19-1.2.2-1PGSTY.el9.x86_64.rpm
pg_duckdb_191.2.2el9.aarch64pigsty29.3 MiBpg_duckdb_19-1.2.2-1PGSTY.el9.aarch64.rpm
pg_duckdb_191.2.2el10.x86_64pigsty33.1 MiBpg_duckdb_19-1.2.2-1PGSTY.el10.x86_64.rpm
pg_duckdb_191.2.2el10.aarch64pigsty30.5 MiBpg_duckdb_19-1.2.2-1PGSTY.el10.aarch64.rpm
postgresql-19-pg-duckdb1.2.2d12.x86_64pigsty20.5 MiBpostgresql-19-pg-duckdb_1.2.2-1PGSTY~bookworm_amd64.deb
postgresql-19-pg-duckdb1.2.2d12.aarch64pigsty17.9 MiBpostgresql-19-pg-duckdb_1.2.2-1PGSTY~bookworm_arm64.deb
postgresql-19-pg-duckdb1.2.2d13.x86_64pigsty21.4 MiBpostgresql-19-pg-duckdb_1.2.2-1PGSTY~trixie_amd64.deb
postgresql-19-pg-duckdb1.2.2d13.aarch64pigsty18.9 MiBpostgresql-19-pg-duckdb_1.2.2-1PGSTY~trixie_arm64.deb
postgresql-19-pg-duckdb1.2.2u22.x86_64pigsty22.2 MiBpostgresql-19-pg-duckdb_1.2.2-1PGSTY~jammy_amd64.deb
postgresql-19-pg-duckdb1.2.2u22.aarch64pigsty20.3 MiBpostgresql-19-pg-duckdb_1.2.2-1PGSTY~jammy_arm64.deb
postgresql-19-pg-duckdb1.2.2u24.x86_64pigsty22.4 MiBpostgresql-19-pg-duckdb_1.2.2-1PGSTY~noble_amd64.deb
postgresql-19-pg-duckdb1.2.2u24.aarch64pigsty20.9 MiBpostgresql-19-pg-duckdb_1.2.2-1PGSTY~noble_arm64.deb
postgresql-19-pg-duckdb1.2.2u26.x86_64pigsty23.2 MiBpostgresql-19-pg-duckdb_1.2.2-1PGSTY~resolute_amd64.deb
postgresql-19-pg-duckdb1.2.2u26.aarch64pigsty21.6 MiBpostgresql-19-pg-duckdb_1.2.2-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_duckdb_181.2.0el8.x86_64pigsty24.8 MiBpg_duckdb_18-1.2.0-1PGSTY.el8.x86_64.rpm
pg_duckdb_181.2.0el8.aarch64pigsty21.3 MiBpg_duckdb_18-1.2.0-1PGSTY.el8.aarch64.rpm
pg_duckdb_181.2.2el9.x86_64pigsty32.1 MiBpg_duckdb_18-1.2.2-1PGSTY.el9.x86_64.rpm
pg_duckdb_181.2.2el9.aarch64pigsty29.4 MiBpg_duckdb_18-1.2.2-1PGSTY.el9.aarch64.rpm
pg_duckdb_181.2.2el10.x86_64pigsty33.2 MiBpg_duckdb_18-1.2.2-1PGSTY.el10.x86_64.rpm
pg_duckdb_181.2.2el10.aarch64pigsty30.5 MiBpg_duckdb_18-1.2.2-1PGSTY.el10.aarch64.rpm
postgresql-18-pg-duckdb1.2.2d12.x86_64pigsty20.5 MiBpostgresql-18-pg-duckdb_1.2.2-1PGSTY~bookworm_amd64.deb
postgresql-18-pg-duckdb1.2.2d12.aarch64pigsty17.9 MiBpostgresql-18-pg-duckdb_1.2.2-1PGSTY~bookworm_arm64.deb
postgresql-18-pg-duckdb1.2.2d13.x86_64pigsty21.5 MiBpostgresql-18-pg-duckdb_1.2.2-1PGSTY~trixie_amd64.deb
postgresql-18-pg-duckdb1.2.2d13.aarch64pigsty18.9 MiBpostgresql-18-pg-duckdb_1.2.2-1PGSTY~trixie_arm64.deb
postgresql-18-pg-duckdb1.2.2u22.x86_64pigsty22.2 MiBpostgresql-18-pg-duckdb_1.2.2-1PGSTY~jammy_amd64.deb
postgresql-18-pg-duckdb1.2.2u22.aarch64pigsty20.3 MiBpostgresql-18-pg-duckdb_1.2.2-1PGSTY~jammy_arm64.deb
postgresql-18-pg-duckdb1.2.2u24.x86_64pigsty22.4 MiBpostgresql-18-pg-duckdb_1.2.2-1PGSTY~noble_amd64.deb
postgresql-18-pg-duckdb1.2.2u24.aarch64pigsty20.8 MiBpostgresql-18-pg-duckdb_1.2.2-1PGSTY~noble_arm64.deb
postgresql-18-pg-duckdb1.2.2u26.x86_64pigsty23.3 MiBpostgresql-18-pg-duckdb_1.2.2-1PGSTY~resolute_amd64.deb
postgresql-18-pg-duckdb1.2.2u26.aarch64pigsty21.6 MiBpostgresql-18-pg-duckdb_1.2.2-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_duckdb_171.2.0el8.x86_64pigsty24.7 MiBpg_duckdb_17-1.2.0-1PGSTY.el8.x86_64.rpm
pg_duckdb_171.2.0el8.aarch64pigsty21.3 MiBpg_duckdb_17-1.2.0-1PGSTY.el8.aarch64.rpm
pg_duckdb_171.2.2el9.x86_64pigsty32.2 MiBpg_duckdb_17-1.2.2-1PGSTY.el9.x86_64.rpm
pg_duckdb_171.2.2el9.aarch64pigsty29.4 MiBpg_duckdb_17-1.2.2-1PGSTY.el9.aarch64.rpm
pg_duckdb_171.2.2el10.x86_64pigsty33.2 MiBpg_duckdb_17-1.2.2-1PGSTY.el10.x86_64.rpm
pg_duckdb_171.2.2el10.aarch64pigsty30.7 MiBpg_duckdb_17-1.2.2-1PGSTY.el10.aarch64.rpm
postgresql-17-pg-duckdb1.2.2d12.x86_64pigsty20.5 MiBpostgresql-17-pg-duckdb_1.2.2-1PGSTY~bookworm_amd64.deb
postgresql-17-pg-duckdb1.2.2d12.aarch64pigsty17.9 MiBpostgresql-17-pg-duckdb_1.2.2-1PGSTY~bookworm_arm64.deb
postgresql-17-pg-duckdb1.2.2d13.x86_64pigsty21.4 MiBpostgresql-17-pg-duckdb_1.2.2-1PGSTY~trixie_amd64.deb
postgresql-17-pg-duckdb1.2.2d13.aarch64pigsty18.9 MiBpostgresql-17-pg-duckdb_1.2.2-1PGSTY~trixie_arm64.deb
postgresql-17-pg-duckdb1.2.2u22.x86_64pigsty22.7 MiBpostgresql-17-pg-duckdb_1.2.2-1PGSTY~jammy_amd64.deb
postgresql-17-pg-duckdb1.2.2u22.aarch64pigsty20.9 MiBpostgresql-17-pg-duckdb_1.2.2-1PGSTY~jammy_arm64.deb
postgresql-17-pg-duckdb1.2.2u24.x86_64pigsty22.4 MiBpostgresql-17-pg-duckdb_1.2.2-1PGSTY~noble_amd64.deb
postgresql-17-pg-duckdb1.2.2u24.aarch64pigsty20.8 MiBpostgresql-17-pg-duckdb_1.2.2-1PGSTY~noble_arm64.deb
postgresql-17-pg-duckdb1.2.2u26.x86_64pigsty23.2 MiBpostgresql-17-pg-duckdb_1.2.2-1PGSTY~resolute_amd64.deb
postgresql-17-pg-duckdb1.2.2u26.aarch64pigsty21.6 MiBpostgresql-17-pg-duckdb_1.2.2-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_duckdb_161.2.0el8.x86_64pigsty24.7 MiBpg_duckdb_16-1.2.0-1PGSTY.el8.x86_64.rpm
pg_duckdb_161.2.0el8.aarch64pigsty21.2 MiBpg_duckdb_16-1.2.0-1PGSTY.el8.aarch64.rpm
pg_duckdb_161.2.2el9.x86_64pigsty32.2 MiBpg_duckdb_16-1.2.2-1PGSTY.el9.x86_64.rpm
pg_duckdb_161.2.2el9.aarch64pigsty29.5 MiBpg_duckdb_16-1.2.2-1PGSTY.el9.aarch64.rpm
pg_duckdb_161.2.2el10.x86_64pigsty33.1 MiBpg_duckdb_16-1.2.2-1PGSTY.el10.x86_64.rpm
pg_duckdb_161.2.2el10.aarch64pigsty30.6 MiBpg_duckdb_16-1.2.2-1PGSTY.el10.aarch64.rpm
postgresql-16-pg-duckdb1.2.2d12.x86_64pigsty20.5 MiBpostgresql-16-pg-duckdb_1.2.2-1PGSTY~bookworm_amd64.deb
postgresql-16-pg-duckdb1.2.2d12.aarch64pigsty17.9 MiBpostgresql-16-pg-duckdb_1.2.2-1PGSTY~bookworm_arm64.deb
postgresql-16-pg-duckdb1.2.2d13.x86_64pigsty21.4 MiBpostgresql-16-pg-duckdb_1.2.2-1PGSTY~trixie_amd64.deb
postgresql-16-pg-duckdb1.2.2d13.aarch64pigsty18.9 MiBpostgresql-16-pg-duckdb_1.2.2-1PGSTY~trixie_arm64.deb
postgresql-16-pg-duckdb1.2.2u22.x86_64pigsty22.7 MiBpostgresql-16-pg-duckdb_1.2.2-1PGSTY~jammy_amd64.deb
postgresql-16-pg-duckdb1.2.2u22.aarch64pigsty20.8 MiBpostgresql-16-pg-duckdb_1.2.2-1PGSTY~jammy_arm64.deb
postgresql-16-pg-duckdb1.2.2u24.x86_64pigsty22.3 MiBpostgresql-16-pg-duckdb_1.2.2-1PGSTY~noble_amd64.deb
postgresql-16-pg-duckdb1.2.2u24.aarch64pigsty20.8 MiBpostgresql-16-pg-duckdb_1.2.2-1PGSTY~noble_arm64.deb
postgresql-16-pg-duckdb1.2.2u26.x86_64pigsty23.2 MiBpostgresql-16-pg-duckdb_1.2.2-1PGSTY~resolute_amd64.deb
postgresql-16-pg-duckdb1.2.2u26.aarch64pigsty21.6 MiBpostgresql-16-pg-duckdb_1.2.2-1PGSTY~resolute_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_duckdb_151.2.0el8.x86_64pigsty24.7 MiBpg_duckdb_15-1.2.0-1PGSTY.el8.x86_64.rpm
pg_duckdb_151.2.0el8.aarch64pigsty21.2 MiBpg_duckdb_15-1.2.0-1PGSTY.el8.aarch64.rpm
pg_duckdb_151.2.2el9.x86_64pigsty32.0 MiBpg_duckdb_15-1.2.2-1PGSTY.el9.x86_64.rpm
pg_duckdb_151.2.2el9.aarch64pigsty29.5 MiBpg_duckdb_15-1.2.2-1PGSTY.el9.aarch64.rpm
pg_duckdb_151.2.2el10.x86_64pigsty33.2 MiBpg_duckdb_15-1.2.2-1PGSTY.el10.x86_64.rpm
pg_duckdb_151.2.2el10.aarch64pigsty30.6 MiBpg_duckdb_15-1.2.2-1PGSTY.el10.aarch64.rpm
postgresql-15-pg-duckdb1.2.2d12.x86_64pigsty20.5 MiBpostgresql-15-pg-duckdb_1.2.2-1PGSTY~bookworm_amd64.deb
postgresql-15-pg-duckdb1.2.2d12.aarch64pigsty17.8 MiBpostgresql-15-pg-duckdb_1.2.2-1PGSTY~bookworm_arm64.deb
postgresql-15-pg-duckdb1.2.2d13.x86_64pigsty21.4 MiBpostgresql-15-pg-duckdb_1.2.2-1PGSTY~trixie_amd64.deb
postgresql-15-pg-duckdb1.2.2d13.aarch64pigsty18.9 MiBpostgresql-15-pg-duckdb_1.2.2-1PGSTY~trixie_arm64.deb
postgresql-15-pg-duckdb1.2.2u22.x86_64pigsty22.7 MiBpostgresql-15-pg-duckdb_1.2.2-1PGSTY~jammy_amd64.deb
postgresql-15-pg-duckdb1.2.2u22.aarch64pigsty20.9 MiBpostgresql-15-pg-duckdb_1.2.2-1PGSTY~jammy_arm64.deb
postgresql-15-pg-duckdb1.2.2u24.x86_64pigsty22.3 MiBpostgresql-15-pg-duckdb_1.2.2-1PGSTY~noble_amd64.deb
postgresql-15-pg-duckdb1.2.2u24.aarch64pigsty20.8 MiBpostgresql-15-pg-duckdb_1.2.2-1PGSTY~noble_arm64.deb
postgresql-15-pg-duckdb1.2.2u26.x86_64pigsty23.2 MiBpostgresql-15-pg-duckdb_1.2.2-1PGSTY~resolute_amd64.deb
postgresql-15-pg-duckdb1.2.2u26.aarch64pigsty21.6 MiBpostgresql-15-pg-duckdb_1.2.2-1PGSTY~resolute_arm64.deb

Source

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

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

Config this extension to shared_preload_libraries:

shared_preload_libraries = 'pg_duckdb';

Create this extension with:

CREATE EXTENSION pg_duckdb;

Usage

Sources:

pg_duckdb embeds DuckDB’s analytical engine in PostgreSQL and can query ordinary PostgreSQL tables and external files. Release 1.2.1 embeds DuckDB 2.0.1; upstream lists PostgreSQL 14–18. It is not relocatable and needs cluster preload.

Enable and Compare a Query

Add the library to the existing setting, then restart PostgreSQL:

shared_preload_libraries = 'pg_duckdb'

As a superuser, install it and inspect an analytical query:

CREATE EXTENSION pg_duckdb;
CREATE TABLE orders (category text, amount numeric);
INSERT INTO orders VALUES ('a', 10), ('a', 20), ('b', 5);
SET duckdb.force_execution = true;
EXPLAIN SELECT category, sum(amount) FROM orders GROUP BY category;
SELECT category, sum(amount) FROM orders GROUP BY category;
SET duckdb.force_execution = false;

Ordinary queries use PostgreSQL unless forced; DuckDB-only functions or remote storage operations choose DuckDB automatically. Inspect the plan and benchmark representative data. read_parquet, read_csv and read_json read external data, while duckdb.create_simple_secret configures storage credentials. Keep secrets out of shared SQL history and verify the access boundary before granting execution.

Privileges and Configuration

duckdb.postgres_role selects the role allowed to execute DuckDB, manage secrets and use MotherDuck data; by default only superusers may do so. A configured role can be created during installation. Grant membership deliberately because it exposes shared DuckDB secrets and data. Local filesystem access is restricted separately through PostgreSQL server-file roles and DuckDB filesystem settings. Community extension loading is an explicit administrator choice.

Transaction and Compatibility Limits

A transaction may not write both PostgreSQL and DuckDB tables, or mix DDL for both engines. Keep duckdb.unsafe_allow_mixed_transactions disabled: bypassing the rule can commit one side only and lose consistency. Execution inside PostgreSQL functions is also disabled by default; the unsafe setting for it has known crash risks.

Version 1.2.1 supports nested fixed-length arrays and improves numeric and floating conversions. It fixes parallel-worker memory reads, cancellation cleanup and secret-bearing log/statistics handling. These fixes do not remove the need to restrict credentials and review type/query compatibility. Install matching libraries, follow preload restart requirements, and update the SQL extension in each database before relying on new behavior.

Release 1.2.2

Version 1.2.2 embeds DuckDB 2.0.1, adds PostgreSQL 19 release artifacts and adjusts CA-bundle loading. Install the matching server-major files and follow the extension’s existing preload and SQL-upgrade procedure; remote-object credentials and TLS configuration still require deliberate administration.

Table reader