Airflow + PostgreSQL

Apache Airflow orchestrating Python-defined DAGs, with PostgreSQL as the metadata database, the standard self-hosted Airflow production setup.

  • Apache AirflowApache Airflow
  • PythonPython
  • PostgreSQLPostgreSQL
Learning curve
Hard
Status
Actively developed
Reviewed
November 2026
Best for
  • Scheduled batch ELT pipelines with many dependent steps
  • Coordinating jobs across warehouses, Spark, dbt and SaaS APIs
  • Backfilling historical date partitions after logic changes
  • ML retraining and feature-refresh pipelines on a schedule
Not ideal for
  • Real-time event processing
  • Single cron job for one application

Overview

Apache Airflow schedules and monitors batch workflows written as Python DAGs, and PostgreSQL stores its metadata: DAG runs, task instance state, connections, variables and XComs. Airflow orchestrates work rather than processing data itself; tasks call out to warehouses, Spark clusters, dbt or APIs. Data teams use it when pipelines have many dependent steps, retries, backfills and cross-system hand-offs that cron cannot express.

What's inside

Writing a first DAG is easy for Python developers, but logical dates, catchup, idempotent task design, executors and running the components in production take real experience.

  • PostgreSQL

    PostgreSQL

    Database

    Stores and queries the data

    Learning: Moderate

    Status: Active

  • Python

    Python

    Language

    The language the code is written in

    Learning: Easy

    Status: Active

  • Apache Airflow

    Apache Airflow

    Infrastructure

    Hosts, deploys or connects the system

    Learning: Hard

    Status: Active

How it works

The DAG processor parses Python DAG files and stores serialized DAGs in PostgreSQL. The scheduler turns them into runs and task instances, an executor hands tasks to workers, and every state change is recorded in the metadata database.

  1. 1.

    Language to infrastructure

    Python DAG files (TaskFlow @task functions, operators, asset or cron schedules) are parsed on a loop by the DAG processor, which runs as its own component in Airflow 3.

  2. 2.

    Infrastructure to database

    Serialized DAGs are written to PostgreSQL. The scheduler reads them and creates DAG runs and task instances, using row-level locking (SELECT ... FOR UPDATE SKIP LOCKED) so several schedulers can run side by side.

  3. 3.

    Infrastructure to infrastructure

    The configured executor (Local, Celery or Kubernetes) dispatches queued tasks to workers. In Airflow 3, workers report state through the API server's Task Execution API instead of connecting to the database directly.

  4. 4.

    Infrastructure to other

    Each task calls an external system through a provider package, such as a Snowflake query, a Spark job submission, a dbt run or an S3 transfer. Heavy data processing happens in that system, not on the Airflow worker.

  5. 5.

    Infrastructure to database

    Task results, retries and small XCom values are stored in PostgreSQL, task logs go to remote storage, and the web UI reads run history from the metadata database.

Strengths and drawbacks

Strengths

  • Large provider ecosystem

    Maintained provider packages cover AWS, GCP, Azure, Snowflake, Databricks, dbt, Kubernetes, Slack and hundreds of other systems, so most integrations are an operator or hook rather than custom glue code.

  • Pipelines as Python code

    DAGs live in git, go through code review and can be generated dynamically. Dynamic task mapping fans out over a runtime list of files or partitions without hand-writing every task.

  • Retries, backfills and run history

    Per-task retries, timeouts, catchup and backfills over date ranges, plus a UI showing every run's state and logs, make failure recovery routine. Airflow 3 added DAG versioning so old runs show the code they actually ran.

  • Managed and self-hosted options

    The same DAGs run on the official Helm chart, Amazon MWAA, Google Cloud Composer or Astronomer, so teams can start self-hosted and move to a managed service later, or the reverse.

Drawbacks

  • Operational weight

    A production deployment means a scheduler, DAG processor, API server, triggerer, workers, a broker for Celery and PostgreSQL to run, upgrade and monitor. Small teams often underestimate this compared to a managed service.

  • Not a data processor or low-latency scheduler

    Task start-up latency is measured in seconds, and pushing large DataFrames through XCom bloats the metadata database. Real data movement belongs in the warehouse, Spark or object storage, with Airflow passing references.

  • Airflow 2 to 3 migration

    Airflow 3 removed SubDAGs, direct metadata-database access from task code, several deprecated imports and context variables. Older DAGs need rework; ruff's AIR rules flag many of the breaking changes.

  • Metadata database growth

    Task instance, log and XCom tables grow with every run. Without periodic airflow db clean and PgBouncer in front of PostgreSQL, scheduler loops slow down and connection counts climb as workers scale.

  • Top-level DAG code pitfalls

    DAG files are re-parsed constantly, so database calls or heavy imports at module level slow parsing for every DAG. Non-idempotent tasks make retries and backfills produce duplicate or wrong data.

Scores

Editorial ratings out of 10, comparable across every stack in the guide. They are judgement, not benchmarks. How we score

Speed of building
6.8 out of 10, catalog average 7.7

How quickly a team ships features

Ease of learning
6.3 out of 10, catalog average 7.2

Higher means easier to pick up

Scalability
7.2 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
6.4 out of 10, catalog average 7.2

How well the codebase ages

Ecosystem
9.0 out of 10, catalog average 8.2

Libraries, hosting, docs and hiring

Flexibility
8.0 out of 10, catalog average 7.4

How many kinds of product it suits

How it scales

Scales by adding workers through the Celery or Kubernetes executor and running multiple schedulers against one PostgreSQL metadata database, which then becomes the component to size and tune.

Starting outMVP and first users
Single VM or Docker Compose with LocalExecutor, one scheduler and a small managed PostgreSQL instance running a few dozen daily DAGs.
GrowingReal traffic, a few engineers
Official Helm chart on Kubernetes with CeleryExecutor or KubernetesExecutor, remote logging to object storage and PgBouncer in front of managed PostgreSQL.
LargeHeavy traffic or data
Multiple schedulers and DAG processors, separate worker queues or pools for heavy integrations, deferrable operators on the triggerer, and scheduled metadata cleanup.
EnterpriseMany teams and regions
Several Airflow deployments split by domain or team on a managed platform (MWAA, Cloud Composer, Astronomer), linked through asset-based scheduling and central observability.

Where it fits

Common projects, from best fit to worst.

  • Nightly warehouse ELT orchestration

    Extract from SaaS APIs and databases, load to the warehouse, then trigger dbt and data-quality checks in dependency order with retries and alerting.

    Great fit

  • ML retraining pipelines

    Schedule feature refresh, training on Kubernetes or a managed ML service, evaluation and model registration as separate retryable tasks.

    Good fit

  • Single cron job for one application

    Running the full Airflow stack for one nightly script adds far more infrastructure than a cron entry, Celery beat or a cloud scheduler.

    Poor fit

  • Real-time event processing

    Per-event or sub-minute processing is outside Airflow's design; use a streaming system such as Kafka consumers or Spark Structured Streaming.

    Avoid

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 Airflow + PostgreSQL.