Deploy Postgres x DuckDB
Postgres 18 with DuckDB using official duckdb image
Postgres x DuckDB
Just deployed
/var/lib/postgresql
Deploy and Host Postgres x DuckDB on Railway
Postgres x DuckDB is a PostgreSQL 18 database with the pg_duckdb extension preloaded, embedding DuckDB's vectorized analytics engine directly inside Postgres. Run fast analytical queries against your existing tables, or read Parquet, CSV, and Iceberg data straight from object storage — all over the Postgres wire protocol your tools already speak.
About Hosting Postgres x DuckDB
Hosting Postgres x DuckDB means running a stateful database, so persistence is the primary concern. This template mounts a volume at /var/lib/postgresql, the directory PostgreSQL 18 uses for its version-specific cluster, so data survives restarts and redeploys. The image is pinned by immutable digest to PostgreSQL 18 with pg_duckdb v1.1.1, making every deployment reproducible. The extension is loaded through shared_preload_libraries and created in the default database on first boot, so there is no manual setup step. Analytical queries are memory-hungry by nature, so size the service to your working set and enable a TCP proxy to connect from outside Railway.
Common Use Cases
- Running analytical and reporting queries on operational Postgres data without exporting it to a separate warehouse
- Querying Parquet, CSV, JSON, and Iceberg files in S3, GCS, or R2 directly with SQL, and joining them against live Postgres tables
- Powering dashboards and embedded analytics that need columnar scan performance but only speak Postgres
Dependencies for Postgres x DuckDB Hosting
- A persistent volume mounted at
/var/lib/postgresql - No external services required — DuckDB runs in-process inside Postgres
Implementation Details
Connect with any standard Postgres client using DATABASE_URL, or DATABASE_PUBLIC_URL from outside Railway. Confirm the extension is active:
SELECT * FROM pg_extension WHERE extname = 'pg_duckdb';
Query remote files directly:
SELECT country, count(*)
FROM read_parquet('s3://my-bucket/events/*.parquet')
GROUP BY country
ORDER BY count DESC;
Force a query through the DuckDB engine with SET duckdb.force_execution = true;, and configure object storage credentials with duckdb.create_simple_secret().
Why Deploy Postgres x DuckDB on Railway?
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Postgres x DuckDB on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Template Content
Postgres x DuckDB
ghcr.io/lassejlv/pgduckdb:18