---
title: "1M Durable Workflows per Second on Postgres"
description: "Sharding Postgres with PgDog let DBOS durable workflow throughput scale linearly from 20K workflows/sec on one db.m7i.4xlarge RDS instance to 1M workflows/sec across 50 shards."
url: "https://swe.quest/articles/1m-durable-workflows-per-second-on-postgres-8f041571c87c6775"
canonical: "https://www.dbos.dev/blog/one-million-workflows"
source: "DBOS"
published: "2026-10-28"
difficulty: "medium"
kind: "Case study"
reading_minutes: 5
tags: ["postgres","distributed-databases","scalability","resilience","messaging"]
---

# 1M Durable Workflows per Second on Postgres

A post on [DBOS](https://swe.quest/sources/dbos.md), published 2026-10-28, 5 min read, Case study. Original: [https://www.dbos.dev/blog/one-million-workflows](https://www.dbos.dev/blog/one-million-workflows)

## Summary

Sharding Postgres with PgDog let DBOS durable workflow throughput scale linearly from 20K workflows/sec on one db.m7i.4xlarge RDS instance to 1M workflows/sec across 50 shards. Linear scaling depends on every workflow operation hitting a single shard, so a shard\_key column is added to workflow\_status and all dependent tables, and workers dequeue one shard at a time. Past roughly 8-16 shards, performance turned metastable: a briefly slow shard (e.g. during VACUUM) attracted more concurrent FOR UPDATE SKIP LOCKED dequeuers, and the resulting lock contention made the shard slower still until the whole cluster collapsed. The fix caps concurrency per shard with a small pool of Postgres advisory 'dequeue locks', and a worker that cannot get one skips to the next shard instead of waiting.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Distributed databases](https://swe.quest/tags/distributed-databases.md) (Data & databases)
- [Scaling](https://swe.quest/tags/scalability.md) (Distributed systems)
- [Resilience](https://swe.quest/tags/resilience.md) (Distributed systems)
- [Queues & messaging](https://swe.quest/tags/messaging.md) (Backend & APIs)

## Prerequisites

- PostgreSQL row locking ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- database sharding basics ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))
- job queue design

## Keywords

DBOS, PgDog, PostgreSQL, FOR UPDATE SKIP LOCKED, advisory locks, Amazon RDS

## Related posts

- [What's New in DBOS - October 2026](https://swe.quest/articles/what-s-new-in-dbos-october-2026-0574d68e693cec1d.md): DBOS · 2026-10-29 · Medium · 5 min read · Distributed systems, PostgreSQL, Scaling, Deployment, Scheduling
  DBOS Transact adds workflow rewind to any step, which discards checkpoints from that step onward and re-executes while preserving the workflow ID.
- [You should shard your database](https://swe.quest/articles/you-should-shard-your-database-12cdc70ed1f6d2d7.md): PgDog · 2025-11-13 · Medium · 7 min read · PostgreSQL, Distributed databases, Scaling, Query engines
  Sharding Postgres early avoids the operational pain of large single instances, illustrated by an outage where stale planner statistics caused a 300 GB table to be sequentially scanned.
- [How savepoints quietly throttled our Postgres queue](https://swe.quest/articles/how-savepoints-quietly-throttled-our-postgres-queue-a32737dd90a62c34.md): incident.io · 2026-10-06 · Hard · 15 min read · PostgreSQL, Performance engineering, Storage engines, Concurrency, Scaling
  Using a SAVEPOINT per tick in a Postgres-backed job queue made every locked row carry a MultiXact ID in xmax.
- [Running Durable Workflows in Postgres using DBOS](https://swe.quest/articles/running-durable-workflows-in-postgres-using-dbos-758f463809fa3e9f.md): Supabase · 2024-12-10 · Medium · 4 min read · PostgreSQL, Scheduling, Resilience, Serverless
  DBOS implements durable workflows entirely in Postgres: workflow and step decorators record a workflow's ID, inputs and status in a workflow\_status table and each step's output in operation\_outputs, all within a separate system database.
- [How Figma’s databases team lived to tell the scale](https://swe.quest/articles/how-figma-s-databases-team-lived-to-tell-the-scale-5117114294b188fe.md): Figma · 2024-03-14 · Medium · 19 min read · PostgreSQL, Distributed databases, Scaling, Query engines
  Figma horizontally sharded its RDS Postgres stack after vertical partitioning ran out of room.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
