---
title: PostgreSQL
description: Configure DurableStack with PostgreSQL for durable, distributed execution.
order: 53
---

# PostgreSQL

PostgreSQL is the recommended default for most production DurableStack deployments.

It supports durable state and multi-worker distributed coordination through shared tables.

## Registration

```csharp
using DurableStack.Hosting.DependencyInjection;

var connectionString = "Host=localhost;Port=5432;Database=durable_stack;Username=postgres;Password=postgres";

builder.Services.AddDurableStackPostgres(connectionString, options =>
{
    options.WorkerName = $"orders-api-{Environment.MachineName}-{Environment.ProcessId}";
});
```

## Operational notes

- Run migrations on startup via `IDurableStackStoreMigrator`.
- Keep retention enabled to control run-history growth.
- Validate multi-worker behavior in staging before scaling out.
