Get Started
pg_mooncake can be installed via Docker or built from source.
Option 1: Docker (recommended)​
Run a self-contained Postgres 17 instance with pg_mooncake pre-installed:
docker run --name mooncake --rm -e POSTGRES_PASSWORD=password mooncakelabs/pg_mooncake
Connect using the bundled psql
client:
docker exec -it mooncake psql -U postgres
Option 2: Build from Source​
pg_mooncake is written in Rust and built with pgrx
. Before compiling make sure you have:
- Rust
- pgrx installed
- Build tools required by DuckDB
Clone the repository (including submodules):
git clone --recurse-submodules https://github.com/Mooncake-Labs/pg_mooncake.git
cd pg_mooncake
Build and install for Postgres 17 (support for additional versions is coming):
make install
Add pg_mooncake to postgresql.conf
and enable logical replication, then restart Postgres:
shared_preload_libraries = 'pg_mooncake'
wal_level = logical
Create the extension​
After Postgres restarts, enable pg_mooncake in your database:
CREATE EXTENSION pg_mooncake;
If you only want to load the shared library for the current session:
LOAD EXTENSION pg_mooncake;
For a detailed step-by-step example, refer to our Dockerfile.