Writing robust data pipelines with AILivestream July 22

Skip to main content

PostgreSQL

Advanced open-source relational database with powerful features and extensibility.

Looking for a Postgres-compatible connection to MotherDuck?

Use the Postgres endpoint to connect any Postgres-wire-compatible client — BI tools, ORMs, serverless runtimes, or languages without a DuckDB SDK — directly to MotherDuck. No extension required.

PostgreSQL is an object-relational database management system (ORDBMS) based on POSTGRES, Version 4.2, developed at the University of California at Berkeley Computer Science Department. POSTGRES pioneered many concepts that only became available in some commercial database systems much later.

As explained by DuckDB Lab's Hannes Mühleisen in the explainer blog post:

PostgreSQL is designed for traditional transactional use cases, "OLTP", where rows in tables are created, updated and removed concurrently, and it excels at this. But this design decision makes PostgreSQL far less suitable for analytical use cases, "OLAP", where large chunks of tables are read to create summaries of the stored data. Yet there are many use cases where both transactional and analytical use cases are important, for example when trying to gain the latest business intelligence insights into transactional data.

Choose the PostgreSQL workflow based on where your query needs to run.

Query MotherDuck from PostgreSQL-compatible clients

Use the Postgres endpoint when an application, BI tool, or serverless runtime needs to connect to MotherDuck through the PostgreSQL wire protocol. This is the preferred path for PostgreSQL-compatible clients because it does not require installing or operating a PostgreSQL extension.

Load PostgreSQL data into MotherDuck

Use DuckDB's PostgreSQL extension when a DuckDB client needs to read from PostgreSQL and copy data into MotherDuck. This workflow is best for one-time loads, backfills, and controlled client-side movement between PostgreSQL, DuckDB, and MotherDuck.

Run DuckDB from inside PostgreSQL

Use pg_duckdb when queries need to run inside a PostgreSQL server with DuckDB or MotherDuck access. This is useful when PostgreSQL-local tables need to be joined with DuckDB or MotherDuck data from the PostgreSQL environment itself.