The Tech ArchiveThe Tech ArchiveThe Tech Archive
Small BusinessMarketingDevelopers
ArticlesTopicsSeriesAbout

Get the practical AI brief

Verified, no-hype AI tips you can actually use - in your inbox. Free.

No spam. We verify what we send. Unsubscribe anytime.

The Tech ArchiveThe Tech Archive

The Tech Archive

AI news, analysis & explainers

AboutSmall BusinessMarketingDevelopersArticlesTopicsSeriesMethodologyAI DisclosureCorrections

© 2026 All rights reserved.

Back to home
0 readers reading
  1. Home
  2. Articles
  3. Artificial Intelligence
  4. Postgres Durable Execution: Ditch External Workers with pg_durable

Contents

Postgres Durable Execution: Ditch External Workers with pg_durable
Artificial Intelligence

Postgres Durable Execution: Ditch External Workers with pg_durable

Learn how pg_durable brings durable execution to Postgres 17. Automate embedding pipelines and background jobs without Redis or Temporal.

Sham

Sham

AI Engineer & Founder, The Tech Archive

4 min read
0 views
July 11, 2026

Verdict: For teams building AI agents or data pipelines, pg_durable is a game-changer that eliminates the need for external task queues like Redis or Temporal. By bringing durable execution directly into PostgreSQL 17, it allows you to run fault-tolerant, long-running workflows with zero extra infrastructure.

Last verified: July 11, 2026 • Status: Public Preview • Compatibility: PostgreSQL 17 & 18 • Core Value: In-database durable execution. Pricing/versions change often — last checked against official Microsoft July 2026 release data.

What is pg_durable?

pg_durable is a Microsoft-developed open-source PostgreSQL extension that implements the "durable execution" pattern. Unlike standard SQL functions that fail if the database restarts, a pg_durable function is a graph of steps that checkpoints its state to disk at every turn. If the database crashes, execution resumes exactly where it left off.

This effectively turns Postgres into a native workflow orchestrator, allowing you to stop "stitching" together cron jobs, background workers, and status tables.

Why Durable Execution Matters for AI Teams

Durable execution is the "unglamorous backbone" of reliable agentic workflows. When you are chunking data for AI vector embeddings or calling external APIs that might time out, you need a system that handles retries and state recovery automatically.

The "Old" Way:

  • Database stores state.
  • Message Queue (Redis/RabbitMQ) handles tasks.
  • Background Workers (Python/Node) execute logic.
  • Scheduler (Cron) triggers work.

The pg_durable Way:

  • PostgreSQL 17 handles everything.
  • Workflows are defined in SQL and executed by a native background worker.
  • State is managed via internal tables, surviving crashes and failovers.

Core Features and Operators

The extension introduces a domain-specific language (DSL) within SQL for building complex graphs.

Operator Purpose Example
~> Sequence Run Step A, then Step B.
|=> Variable Binding Save Step A result into a variable for Step B.
& Parallel Run Step A and Step B at the same time.

Key Functions

  • df.start(graph): Initiates a new durable workflow.
  • df.status(id): Checks the progress of a running task.
  • df.signal(id, name, data): Wakes a "parked" workflow for human-in-the-loop approval.

3 Production Use Cases for 2026

Teams are already using pg_durable to simplify autonomous AI SEO and data ingest:

  1. Vector Embedding Pipelines: Automatically chunk text, call an embedding API, and upsert into pgvector 0.8.2.
  2. Human-in-the-Loop Approvals: Start a workflow, "park" it for 24 hours while waiting for a df.signal from a manager, then commit changes.
  3. Scheduled Maintenance: Use df.wait with cron expressions to refresh materialized views or detect table bloat without external schedulers.

How to Install pg_durable

pg_durable is available for PostgreSQL 17 and 18. It requires the duroxide Rust runtime (included in official packages).

1. Official Docker Image

The fastest way to test is the official GitHub Container Registry image:

docker run --name pg-durable -e POSTGRES_PASSWORD=*** -d ghcr.io/microsoft/pg_durable:latest

2. Manual Installation (Ubuntu 24.04)

sudo apt install -y postgresql-17-pg_durable
# Edit postgresql.conf
# shared_preload_libraries = 'pg_durable'
# Restart Postgres
sudo systemctl restart postgresql

3. Enable Extension

CREATE EXTENSION pg_durable;
SELECT df.grant_usage('your_app_role');

What this means for you

If you are currently managing a fleet of Celery or BullMQ workers just to update database rows, you can likely delete hundreds of lines of boilerplate. pg_durable lets your database handle the reliability of the workflow, so your productivity engines can focus on the business logic.

FAQ

Q: Does pg_durable replace Temporal? A: For SQL-heavy workflows, yes. However, if your steps require complex in-memory control flow or non-HTTP SDKs, a general-purpose orchestrator like Temporal is still superior.

Q: Can it run parallel tasks? A: Yes, using the & operator or df.join, you can fan out into multiple parallel queries and wait for all to finish before joining results.

Q: Is it safe for production? A: It is currently in Public Preview. While stable on Azure HorizonDB, self-hosted users should benchmark carefully, as background workers consume database resources.

Q: How does it handle retries? A: Retries are automatic and deterministic. If a step fails due to a transient error, the duroxide runtime re-executes the node based on your configured policy.

Sources
  • Microsoft pg_durable GitHub Repository
  • PostgreSQL 17 Official Documentation
  • Azure HorizonDB Release Notes (June 2026)
  • pgvector 0.8.2 Feature List
Updates & Corrections
  • 2026-07-11: Initial guide published; verified against pg_durable v0.2.2.

Get the practical AI brief

Verified, no-hype AI tips you can actually use - in your inbox. Free.

No spam. We verify what we send. Unsubscribe anytime.

Tags

#"pg_durable"#"open source"#["Microsoft"#"workflow automation"]#["PostgreSQL"#"AI infrastructure"

Discussion

0 comments
Sham

Sham

AI Engineer & Founder, The Tech Archive

AI engineer (Azure AI-102/AI-900). Writes practical, tested, hype-free guides on using AI for real work and small business at The Tech Archive.

Related Articles

View all
Odysseus Review: The Self-Hosted AI Operating System for Total Data Sovereignty
Artificial Intelligence

Odysseus Review: The Self-Hosted AI Operating System for Total Data Sovereignty

5 min
Precision vs. Atmosphere: The 2026 AI Developer's Guide to Sol and Fable 5
Artificial Intelligence

Precision vs. Atmosphere: The 2026 AI Developer's Guide to Sol and Fable 5

6 min
Mastering GPT-5.6: Build and Automate Anything with OpenAI's New Tiered AI
Artificial Intelligence

Mastering GPT-5.6: Build and Automate Anything with OpenAI's New Tiered AI

7 min
FluidVoice Review: The Best Free & Open-Source Dictation for Mac (2026)
Artificial Intelligence

FluidVoice Review: The Best Free & Open-Source Dictation for Mac (2026)

5 min
Best AI Models for Coding in 2026: GPT-5.6 vs. Fable 5 vs. Grok 4.5
Artificial Intelligence

Best AI Models for Coding in 2026: GPT-5.6 vs. Fable 5 vs. Grok 4.5

5 min
Grok 4.5 vs. Fable 5 vs. GPT 5.5: The 2026 Guide to Agentic ROI
Artificial Intelligence

Grok 4.5 vs. Fable 5 vs. GPT 5.5: The 2026 Guide to Agentic ROI

4 min