microsoft/pg_durable

Public

PostgreSQL in-database durable execution

  • Stars2.9k+13 tuần này
  • Forks83
  • Watchers4
  • Issues9
  • Ngày tạo14/02/2026
  • Cập nhật gần nhất02/12/2026
  • Ngôn ngữRust
  • Giấy phép—
README.md41.2 KBRaw
pg_durable logo

Website · Docs · Quick Example · GitHub

License PostgreSQL 17 & 18

Durable Execution inside PostgreSQL

Long-running, fault-tolerant SQL functions for teams that already keep their state in Postgres and want to stop stitching together cron jobs, workers, queues, and status tables to make background work reliable. Define the workflow in SQL, let pg_durable checkpoint each step, and resume after crashes, restarts, or failed steps.

Durable execution is now a standard industry pattern, and pg_durable brings it inside Postgres with no extra service infrastructure required. Part of our mission to bring compute close to data.

Azure HorizonDB logo Try pg_durable now in Azure HorizonDB, Microsoft's new PostgreSQL cloud service engineered for performance and built with pg_durable inside

Is this for me?

Who it's for

  • Backend and data engineers who want workflows to live next to the data they touch.
  • DBAs and SREs automating runbooks that must survive restarts and be auditable in SQL.
  • Teams building data or AI pipelines that need durable execution per row, document, or batch.

The core idea

A pg_durable function is a graph of SQL steps that PostgreSQL executes and checkpoints as it goes. If the database crashes, restarts, or a step fails, execution resumes from the last durable checkpoint instead of making you reconstruct state by hand.

A durable function fans out into three parallel queries — count users, count orders, sum revenue — that join into a dashboard step

Workloads this is useful for

  • Vector embedding pipelines: chunk, call an embedding API, and upsert into pgvector.
  • Ingest pipelines: stage, deduplicate, transform, and publish large batches.
  • Scheduled maintenance: detect bloat, notify, wait for approval, then run the next action.
  • Fan-out aggregation: run independent queries in parallel, then join the results.
  • External API workflows: enrichment, classification, and webhook-style calls from SQL.

What you're probably doing today instead

  • pg_cron plus a jobs table, status columns, retry counters, and a polling worker.
  • An external orchestrator such as Airflow, Temporal, Step Functions, or Argo calling back into Postgres.
  • A queue plus workers plus a separate state table to coordinate retries and partial completion.

Nội dung README thuộc về microsoft và cộng đồng đóng góp, giấy phép Không có giấy phép. Nguồn: github.com/microsoft/pg_durable