pg_duckdb (open source)
pg_duckdb is the open source program (MIT license) which embeds DuckDB’s analytics engine and features into Postgres. pg_duckdb was co-developed and maintained by Hydra, DuckDB Labs, and MotherDuck.
If you think pg_duckdb is neat, please consider adding your friendly Github star ⭐ to the pg_duckdb repository!
Run with Docker
Docker images are available on Dockerhub and are based on the official Postgres image. Use of this image is the same as the Postgres image. For example, you can run the image directly:
Or you can use the docker compose in this repo:
Once started, connect to the database using psql:
For other usages see our Docker specific README.
Compile from Source
To build pg_duckdb, you need:
- Postgres 15-17
- Ubuntu 22.04-24.04 or MacOS
- Standard set of build tools for building Postgres extensions
- Build tools that are required to build DuckDB
To build and install, run:
Add pg_duckdb
to the shared_preload_libraries
in your postgresql.conf
file:
Next, create the pg_duckdb
extension:
Sample Queries
pg_duckdb Roadmap
Please view our milestones on the pg_duckdb repo for what’s planned for future releases.