The Curated Daily
← Back to the archiveDispatch · 6 min read
Dispatch

pg_durable: Microsoft open sources in-database durable execution

By the editors·Saturday, June 6, 2026·6 min read
Laptop with code editor open on a rooftop, showcasing remote web development and modern work flexibility.
Photograph by Meet Patel · Pexels

The world of finance hinges on trust. And that trust is built, in large part, on the integrity and reliability of the underlying data systems. Financial institutions handle millions of transactions daily, and even a small data corruption or processing error can have significant repercussions. Enter pg_durable, a recently open-sourced extension for PostgreSQL by Microsoft. This isn’t just another database tool; it’s a potential paradigm shift in how financial applications are built, promising to enhance data durability, simplify complex patterns, and improve overall system resilience. This article dives deep into what pg_durable is, why it matters for the finance industry, and how it compares to existing solutions.

What is pg_durable?

pg_durable is an open-source PostgreSQL extension focused on providing durable execution. But what does that mean? Traditionally, achieving reliable asynchronous processing in systems involving databases can be incredibly complex. Think about a scenario where you need to update a database and send a message to another service. If the message sending fails after the database update, you’re left with an inconsistent state – a nightmare in finance.

pg_durable solves this problem by providing a mechanism to ensure that operations, particularly those involving external systems, are executed durably. It leverages the power of PostgreSQL's transactionality and introduces the concept of durable functions. These functions ensure that if an operation fails mid-way, it's automatically retried until it succeeds, or rolled back completely, maintaining data consistency. It’s essentially bringing the reliability of database transactions to asynchronous operations.

Imagine needing to record a trade and simultaneously notify a clearinghouse. pg_durable allows you to wrap this entire process in a durable function, ensuring that either both actions happen successfully, or neither does, preventing data inconsistencies.

![Diagram illustrating pg_durable ensuring durable execution of a transaction, showing database update and external system notification.](alt_text: pg_durable diagram illustrating durable execution of financial transaction)

Why is Durable Execution Critical for Finance?

The finance industry has some of the most stringent requirements for data integrity and reliability. Here’s why pg_durable is particularly relevant:

  • ACID Compliance: Finance demands Atomic, Consistent, Isolated, and Durable (ACID) transactions. pg_durable extends ACID guarantees to asynchronous operations, which is crucial for modern, event-driven financial systems.
  • Regulatory Compliance: Financial institutions face strict regulatory oversight (e.g., Dodd-Frank, Basel III). Accurate and auditable transaction records are paramount. pg_durable simplifies demonstrating compliance by ensuring every operation is reliably recorded.
  • Fraud Prevention: Data consistency is essential for detecting and preventing fraudulent activities. Inconsistent data can mask fraudulent transactions or make it difficult to trace funds.
  • High-Volume Transaction Processing: Modern financial markets generate massive volumes of transactions. pg_durable provides a scalable and reliable way to handle this load without compromising data integrity.
  • The Outbox Pattern: pg_durable effectively implements the outbox pattern, a common solution for reliably publishing events (like trade confirmations) alongside database updates. This pattern avoids the risks associated with traditional approaches where events are published before database commits.

Key Features and Concepts of pg_durable

Let’s break down the core elements that make pg_durable so powerful:

  • Durable Functions: User-defined functions that are guaranteed to be executed durably, even in the face of failures. They are the building blocks of reliable asynchronous operations.
  • Retry Mechanism: pg_durable automatically retries failed operations, potentially with exponential backoff, to handle transient errors.
  • Rollback Capabilities: If an operation consistently fails, pg_durable can roll back the entire transaction, ensuring data consistency.
  • Eventual Consistency: While prioritizing durability, pg_durable often aligns with eventual consistency patterns for external system updates, acknowledging that some delays may occur but guaranteeing eventual completion.
  • PostgreSQL Integration: Being a PostgreSQL extension, pg_durable benefits from PostgreSQL’s robust features, including its well-established ecosystem and security.
  • Idempotency: Crucially, the functions used with pg_durable should ideally be idempotent. This means running the function multiple times has the same effect as running it once, preventing unintended side effects during retries.

How does pg_durable compare to existing solutions?

Several approaches exist for handling reliable asynchronous processing. Here’s a comparison:

| Approach | Pros | Cons | Suitability for Finance |

|---|---|---|---| | Traditional Message Queues (e.g., RabbitMQ, Kafka) | Mature, scalable, flexible | Requires separate infrastructure, complexity managing message delivery guarantees | Can be used but requires careful configuration to ensure durability and atomicity with database operations. | | Two-Phase Commit (2PC) | Strong consistency | Complex to implement, potential performance bottlenecks, requires all participants to support 2PC | Limited scalability and complexity make it less ideal for modern financial systems. | | Outbox Pattern (Manual Implementation) | Relatively simple concept | Requires significant development effort to implement reliably, prone to errors | Can be effective, but pg_durable offers a more robust and automated approach. | | pg_durable | Simplified durable execution, leverages PostgreSQL’s ACID properties, reduced operational complexity | Relatively new, limited community support compared to established message queues | Highly suitable due to its focus on data integrity, regulatory compliance, and reliable transaction processing. |

![Table comparing different solutions for durable execution in finance.](alt_text: comparison table of durable execution solutions for finance)

Use Cases in Financial Applications

Here are some specific examples of how pg_durable could be used in the finance industry:

  • Trade Execution and Settlement: Ensuring that trade confirmations are sent to all relevant parties (brokers, clearinghouses, regulators) after a trade is executed and settled.
  • Payment Processing: Guaranteeing that payments are recorded in the database and notifications are sent to payers and payees.
  • Loan Origination: Ensuring that loan applications are processed correctly and all associated records are updated consistently.
  • Fraud Detection: Reliably logging all transaction details for fraud analysis and investigation.
  • Regulatory Reporting: Generating accurate and auditable reports for regulatory compliance.
  • Cross-Border Payments: Coordinating transactions across multiple systems and currencies, ensuring reliable delivery and settlement.

Getting Started with pg_durable

Microsoft provides comprehensive documentation and examples to help you get started with pg_durable. You’ll need:

  1. PostgreSQL: A running PostgreSQL instance (version 13 or later is recommended).
  2. pg_durable Extension: Install the extension from the official GitHub repository: https://github.com/microsoft/pg_durable
  3. PL/pgSQL Knowledge: Familiarity with PostgreSQL’s procedural language (PL/pgSQL) is essential for writing durable functions.

You can find helpful tutorials and examples on the Microsoft documentation pages and through community forums. Consider using a robust PostgreSQL IDE like DBeaver (https://example.com/ - check for compatibility and latest versions) or pgAdmin to manage your database and write queries. For cloud-based PostgreSQL solutions, explore offerings from AWS, Azure, or Google Cloud.

The Future of pg_durable

pg_durable is still a relatively new project, but it has the potential to become a foundational component of modern financial systems. Future development may include:

  • Enhanced Monitoring and Observability: Improved tools for tracking the status of durable functions and diagnosing issues.
  • Integration with Cloud Platforms: Seamless integration with popular cloud databases and eventing services.
  • Community Contributions: A growing community of developers contributing to the project’s evolution.
  • Performance Optimization: Further refinements to improve the performance of durable functions.

Conclusion

pg_durable represents a significant advancement in database technology for the finance industry. By simplifying durable execution and extending ACID guarantees to asynchronous operations, it addresses a critical need for reliable data processing in complex financial applications. Its open-source nature and strong integration with PostgreSQL make it a compelling option for organizations looking to build more robust, compliant, and trustworthy financial systems. As the project matures and gains wider adoption, pg_durable is poised to become a key enabler of innovation in the world of finance.

Disclaimer:

This article contains affiliate links. If you purchase a product through these links, we may earn a small commission at no extra cost to you. This helps support our website and allows us to continue providing valuable content. We only recommend products we believe are genuinely helpful and relevant to our audience.

Pass it onX·LinkedIn·Reddit·Email
The Sunday note

If this was your kind of read.

Sign up for the morning email — short, hand-written, and sent only when there's something worth your time.

Free, sent from a person, not a system. Unsubscribe in one click whenever.

Keep reading

The archive →