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.

  • dbtdbt
  • PostgreSQLPostgreSQL
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

    PostgreSQL

    Database

    Stores and queries the data

    Learning: Moderate

    Status: Active

  • dbt

    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. 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. 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. 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. 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. 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

How quickly a team ships features

Ease of learning
7.8 out of 10, catalog average 7.2

Higher means easier to pick up

Scalability
5.4 out of 10, catalog average 7.6

How far it grows before a redesign

Performance
5.8 out of 10, catalog average 7.5

Speed of the running application

Maintainability
8.2 out of 10, catalog average 7.2

How well the codebase ages

Ecosystem
8.0 out of 10, catalog average 8.2

Libraries, hosting, docs and hiring

Flexibility
6.8 out of 10, catalog average 7.4

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.

Sources

Reviewed on November 19, 2026 against the documentation below. Found something out of date? Suggest a correction. Read our methodology.

Stacks that share technologies with dbt + PostgreSQL.