---
title: "Durable and auditable workflows with DBOS and ClickHouse Managed Postgres"
description: "DBOS is an open-source, Postgres-native durable execution library that stores workflow state, step checkpoints, queues, schedules, and messages directly in Postgres, enabling failure recovery from the last completed step without restarting. ClickHouse Managed Postgres provides the operational database for running DBOS workflows with fast NVMe performance. To manage storage growth while retaining history for auditing, WalShadow replicates workflow data from Postgres to ClickHouse by reading the Postgres Write-Ahead Log, with soft deletes that keep tombstoned rows via metadata columns _is_deleted and _commit_ts. This retains execution history for years in ClickHouse, such as three years for compliance, while removing it from Postgres after a shorter retention like seven days, recording deletion timestamps. Developers can then query historical and deleted workflows in ClickHouse to analyze failures and build dashboards without a custom data export pipeline."
---

# Durable and auditable workflows with DBOS and ClickHouse Managed Postgres

[Clickhouse](https://yomu.fyi/company/clickhouse) · Qian Li · Nov 24, 2026

**Type:** Tutorial

## Summary

DBOS is an open-source, Postgres-native durable execution library that stores workflow state, step checkpoints, queues, schedules, and messages directly in Postgres, enabling failure recovery from the last completed step without restarting. ClickHouse Managed Postgres provides the operational database for running DBOS workflows with fast NVMe performance. To manage storage growth while retaining history for auditing, WalShadow replicates workflow data from Postgres to ClickHouse by reading the Postgres Write-Ahead Log, with soft deletes that keep tombstoned rows via metadata columns \_is\_deleted and \_commit\_ts. This retains execution history for years in ClickHouse, such as three years for compliance, while removing it from Postgres after a shorter retention like seven days, recording deletion timestamps. Developers can then query historical and deleted workflows in ClickHouse to analyze failures and build dashboards without a custom data export pipeline.

## Context

Building reliable applications is hard because failures can happen at any step, such as timeouts or crashes. Production systems also need to retain and analyze workflow history for auditing without overwhelming the operational database with storage and maintenance overhead.

## Approach / What changed

Set up DBOS with ClickHouse Managed Postgres as the operational database. Use WalShadow to automatically replicate workflow data from Postgres to ClickHouse by reading the Postgres Write-Ahead Log. Enable soft deletes on WalShadow to keep tombstoned rows in ClickHouse after deletion from Postgres, allowing long-term auditing and analytics.

## Takeaways

- DBOS stores workflow execution state in Postgres, allowing workflows to recover from failures from their last completed step rather than restarting.
- WalShadow replicates Postgres data to ClickHouse via the WAL with soft deletes, preserving deleted workflow records as tombstoned rows with commit timestamps for auditing.
- This combination provides durable execution and scalable analytics without requiring a separate orchestration server or a custom data export pipeline, using ClickHouse for long-term history.

## FAQ

### How does DBOS recover from failures?

If an application process fails or restarts, DBOS recovers workflows from their last completed step because execution state is stored in Postgres. This avoids restarting work from the beginning.

### How can I retain workflow history for years without overloading Postgres?

Use WalShadow to replicate workflow data to ClickHouse with soft deletes. Tombstoned rows are kept in ClickHouse after deletion from Postgres, allowing long-term retention for compliance while Postgres only keeps recent data.

### What metadata does WalShadow add to replicated rows?

WalShadow appends four metadata columns: \_lsn, \_xid, \_commit\_ts, and \_is\_deleted. A deleted row in Postgres arrives as a new version with \_is\_deleted=1 and \_commit\_ts set to the delete transaction's commit time.

**Tags:** [ClickHouse](https://yomu.fyi/topic/clickhouse), [DBOS](https://yomu.fyi/topic/dbos), [Postgres](https://yomu.fyi/topic/postgres), [Replication](https://yomu.fyi/topic/replication), [Workflows](https://yomu.fyi/topic/workflows)

- Source: [Clickhouse](https://clickhouse.com/blog/dbos-clickhouse-managed-postgres-durable-workflows)
- Source URL: https://clickhouse.com/blog/dbos-clickhouse-managed-postgres-durable-workflows
- Ingested by Yomu: 2026-11-24T21:00:09.268Z

[Read original post](https://clickhouse.com/blog/dbos-clickhouse-managed-postgres-durable-workflows)
