dbt + PostgreSQL
dbt Core SQL models built inside PostgreSQL with the dbt-postgres adapter, a low-cost analytics warehouse for small and mid-sized data teams.
- dbt
- PostgreSQL
- Learning curve
- Moderate
- Status
- Actively developed
- Reviewed
- November 2026
- Best for
- Startups and small teams building a first analytics warehouse
- Analytics datasets in the gigabytes to low hundreds of gigabytes
- Self-hosted or on-premises analytics with no cloud warehouse
- Local development and CI for dbt projects using Postgres in Docker
- Not ideal for
- Multi-terabyte event analytics
Overview
This stack uses dbt Core to turn raw tables into tested, documented models inside a PostgreSQL database that serves as the analytics warehouse. Loaders such as Airbyte, dlt, Fivetran or logical replication land source data in a raw schema, and dbt builds staging, intermediate and mart models in SQL. It suits teams whose data fits comfortably on one Postgres server and who want warehouse-style practices without a cloud warehouse bill or a new database to operate.
What's inside
Anyone comfortable with SQL can ship dbt models quickly; the harder parts are dimensional modelling, incremental strategies and PostgreSQL tuning such as indexes, vacuum and memory settings.
PostgreSQL
Database
Stores and queries the data
Learning: Moderate
Status: Active
dbt
Other
Supporting tool
Learning: Easy
Status: Active
How it works
Source data is loaded into raw schemas, dbt compiles Jinja-templated SQL into a dependency graph, and PostgreSQL runs every model as tables, views or incremental inserts that BI tools then read.
- 1.
Other to database
An ELT tool, a replication slot from the application database or a Python loader writes source tables into a raw schema in the analytics Postgres instance.
- 2.
Other to other
dbt parses models, sources, tests and YAML properties, resolves ref() and source() calls into a DAG, and compiles each model to plain PostgreSQL SQL.
- 3.
Other to database
dbt runs models in dependency order over several threads, building each table into a temporary relation and renaming it into place inside a transaction so readers never see half-built tables.
- 4.
Database to other
dbt tests (unique, not_null, relationships, accepted_values and unit tests) query the built models, and failures stop downstream models when run with dbt build.
- 5.
Database to other
Metabase, Superset, Grafana or notebooks query the mart schemas directly over the standard Postgres protocol.
Strengths and drawbacks
Strengths
Low cost and familiar operations
PostgreSQL runs anywhere, from a Docker container to managed RDS, Cloud SQL or Azure services, with predictable instance pricing and no per-query or per-credit billing.
Transactional DDL
PostgreSQL can roll back CREATE, DROP and RENAME, so dbt swaps rebuilt tables in atomically and a failed model leaves the previous version intact.
Postgres-specific model configs
The dbt-postgres adapter supports per-model indexes, unlogged tables for faster intermediate builds and materialized views, so marts can be tuned for the dashboards that read them.
Same engineering workflow as larger warehouses
Models, tests, docs, packages such as dbt-utils and slim CI with state:modified+ work the same way, so the project ports to Snowflake, BigQuery or Redshift later with mostly SQL-dialect changes.
Drawbacks
Row-store limits for analytics
PostgreSQL stores rows, not columns, so wide aggregations over hundreds of millions of rows are slow compared with columnar warehouses, and parallel query only partly closes the gap.
Single-node vertical scaling
Compute and storage grow by resizing one primary. Once nightly builds outgrow the largest practical instance, the usual fixes are incremental models, columnar extensions or moving to a cloud warehouse.
Running against the application database
Building models on the production OLTP primary competes for CPU and I/O, and dbt's table swaps take ACCESS EXCLUSIVE locks. Use a separate analytics instance fed by replication or ELT.
Incremental models need care
Incremental models are how Postgres projects keep build times down, but they depend on a correct unique_key and is_incremental() filter; mistakes silently duplicate rows or drop late-arriving data until a full refresh.
dbt fusion engine adapter coverage
dbt Labs' Rust-based Fusion engine launched with cloud warehouse adapters first. Check current Postgres support before planning on Fusion-only features; most Postgres projects run dbt Core.
Scores
Editorial ratings out of 10, comparable across every stack in the guide. They are judgement, not benchmarks. How we score
- Speed of building
- 8.0 out of 10, catalog average 7.7
- Ease of learning
- 7.8 out of 10, catalog average 7.2
- Scalability
- 5.4 out of 10, catalog average 7.6
- Performance
- 5.8 out of 10, catalog average 7.5
- Maintainability
- 8.2 out of 10, catalog average 7.2
- Ecosystem
- 8.0 out of 10, catalog average 8.2
- Flexibility
- 6.8 out of 10, catalog average 7.4
How quickly a team ships features
Higher means easier to pick up
How far it grows before a redesign
Speed of the running application
How well the codebase ages
Libraries, hosting, docs and hiring
How many kinds of product it suits
How it scales
Scales vertically on a single PostgreSQL primary; incremental models and careful indexing stretch it, but large analytical volumes eventually push teams to a columnar warehouse.
- Starting outMVP and first users
- Postgres in Docker or a small managed instance, dbt Core run from a laptop or a GitHub Actions cron, and Metabase reading the mart schema.
- GrowingReal traffic, a few engineers
- Dedicated managed Postgres analytics instance fed by Airbyte, dlt or logical replication, with dbt scheduled by Airflow or Dagster and slim CI on pull requests.
- LargeHeavy traffic or data
- Large-memory instance with tuned work_mem and parallel workers, incremental models on time-partitioned tables, unlogged intermediate tables and materialized views for hot dashboards.
- EnterpriseMany teams and regions
- Rarely the end state: teams add a columnar extension or distributed Postgres such as Citus, or migrate the dbt project to Snowflake, BigQuery or Redshift as data and concurrency grow.
Where it fits
Common projects, from best fit to worst.
First analytics warehouse for a SaaS startup
Replicate the product database and Stripe or CRM data into Postgres, then build tested revenue and usage marts for Metabase at low cost.
Great fit
dbt development and CI environment
A disposable Postgres container gives fast, free CI runs for dbt packages and SQL logic that stay close to standard SQL.
Good fit
Multi-terabyte event analytics
Full scans and aggregations over billions of event rows are slow on a row store; a columnar warehouse or ClickHouse fits much better.
Poor fit
Alternatives
Similar stacks, and when you would choose them instead.
- dbt + Snowflake
Move to Snowflake when data volume, concurrent BI users or build times outgrow one Postgres server and elastic, per-second compute is worth the cost.
Comparedbt + PostgreSQL with dbt + Snowflake - ClickHouse analytics
Pick ClickHouse when the workload is large append-only event data needing interactive aggregations rather than modelled business tables.
Comparedbt + PostgreSQL with ClickHouse analytics - Python + pandas
For one-off analysis or small file-based datasets, a pandas notebook is quicker than standing up a warehouse and dbt project.
Comparedbt + PostgreSQL with Python + pandas
Sources
Reviewed on November 19, 2026 against the documentation below. Found something out of date? Suggest a correction. Read our methodology.
- dbt PostgreSQL setup
Official dbt Postgres adapter docs.
- dbt documentation
Official dbt docs.
- PostgreSQL documentation
Official PostgreSQL docs.
Related stacks
Stacks that share technologies with dbt + PostgreSQL.
Airflow + PostgreSQL
Apache Airflow orchestrating Python-defined DAGs, with PostgreSQL as the metadata database, the standard self-hosted Airflow production setup.
- Apache Airflow
- Python
- PostgreSQL
Learning: Hard
PERN
PostgreSQL, Express, React, and Node.js, a relational-database variant of MERN used heavily in production SaaS.
- PostgreSQL
- Express
- React
- +2
Learning: Moderate
Next.js + PostgreSQL
Next.js talking to PostgreSQL through a plain SQL driver such as node-postgres, postgres.js or Neon's serverless driver: no ORM, full control of the SQL.
- Next.js
- Node.js
- TypeScript
- +1
Learning: Moderate