pg_duckdb
DuckDB Embedded in Postgres
pg_duckdb : DuckDB Embedded in Postgres
Overview
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-- | No | Yes | Yes | Yes | no | no |
| Relationships | |
|---|---|
| Schemas | public |
| Need By | pg_mooncake |
| See Also | pg_mooncake pg_ducklake duckdb_fdw pg_parquet pg_lake pg_clickhouse aws_s3 file_fdw pg_bulkload columnar |
conflict with duckdb_fdw
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.1.1 |
18 17 16 15 14 | pg_duckdb |
- |
| RPM | PIGSTY | 1.1.1 |
18 17 16 15 14 | pg_duckdb_$v |
- |
| DEB | PIGSTY | 1.1.1 |
18 17 16 15 14 | postgresql-$v-pg-duckdb |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| el8.aarch64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| el9.x86_64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| el9.aarch64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| el10.x86_64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| el10.aarch64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| d12.x86_64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| d12.aarch64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| d13.x86_64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| d13.aarch64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| u22.x86_64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| u22.aarch64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| u24.x86_64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| u24.aarch64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| u26.x86_64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
| u26.aarch64 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 | PIGSTY 1.1.1 |
Source
github.com/duckdb/pg_duckdb
pg_duckdb-1.1.1.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
| Topic | Description |
|---|---|
| Functions | Complete reference for all available functions |
| Syntax Guide & Gotchas | Quick reference for common SQL patterns and things to know |
| Types | Supported data types and type mappings |
| Extensions | DuckDB extension installation and usage |
| Settings | Configuration options and parameters |
| Transactions | Transaction behavior and limitations |
Quick Setup
Install pg_duckdb with pig:
Edit postgresql.conf, then restart to take effect
Accelerate Query
You can use DuckDB to query existing PostgreSQL table without modifying them:
The result would be 8s -> 4s on 4c VM on local laptop) :
Data Lake
Let’s play with a local minio instance: