30 years of database durability: Oracle and PostgreSQL
I began taking on database administration tasks with Oracle7 nearly 30 years ago. Most of Oracle's core recovery concepts were already in place: redo, undo, checkpoints, and recovery from instance or media failure.
In this article, I'll explore what has remained the same and what has changed significantly over those three decades. I'll also compare Oracle Database with PostgreSQL, which adopted WAL-based recovery later and has since become one of the most popular open-source alternatives to commercial databases. This article is subjective and may be incomplete, given the many smaller changes. It reflects my experience and recollections of the features and internals. For an objective overview of Oracle Database recovery as of Oracle7, read Andrea Borr and Bill Bridge’s Oracle7 v7.2 Recovery Outline (part 1 & part 2 in the internet archives).
Redo, undo, and commit
Oracle can write modified blocks to a datafile before the transaction commits (steal) and commit without writing modified data blocks (no-force). This avoids scattered datafile writes at commit but requires recovery.
PostgreSQL adopted WAL in 7.1, in 2001. Before then, data modifications had to be written to disk before commit. Afterward, flushing the log was sufficient.
Two rules connect performance and correctness:
- Write-ahead logging: before DB Writer writes a dirty block, the redo required to recover its changes must be durable.
- Durable commit: the transaction's redo, including its commit record, must be persisted before success is acknowledged. Its data blocks can be written later.
Redo includes uncommitted changes and changes to undo blocks. Oracle recovery rolls forward logged changes, reconstructs undo, and then uses it to roll back the effects of uncommitted changes.
PostgreSQL's MVCC implementation dates back to 6.5, in 1999. Heap row versions and transaction status keep aborted changes invisible without Oracle-style undo. Pruning and VACUUM reclaim dead versions. Oracle can open before background transaction rollback finishes, using on-demand undo for blocks accessed in the meantime. PostgreSQL does not need to physically remove every aborted row version before accepting connections.
Automatic undo management was introduced in 9i, replacing the need to manage rollback segments manually. In 10g, in-memory undo and private redo reduced contention in small transactions. These changes made the existing MVCC implementation easier to administer and more scalable.
Oracle's COMMIT WRITE IMMEDIATE NOWAIT can acknowledge commits before redo is flushed. PostgreSQL added synchronous_commit=off in 8.3, in 2008. Both settings relax commit durability, not WAL ordering. Disabling PostgreSQL's fsync risks corruption, not merely lost commits. Both systems also support group commit, where several commits share a single log flush. Since Oracle 11g, RMAN’s backup undo optimization automatically excludes undo for already-committed transactions when it is no longer needed for recovery, rather than copying all the undo retained for read consistency.
SCNs, LSNs, and recovery metadata
| Purpose | Oracle Database | PostgreSQL |
|---|---|---|
| Logical consistency | SCNs order changes and identify consistent states. | MVCC snapshots use transaction IDs and transaction status. An LSN is not an SCN. |
| Position in redo | An RBA identifies a location within a redo thread: log sequence, block, offset. | An LSN is a byte position. Timeline identity distinguishes branches. |
| Recovery metadata | Control files, datafile headers, and log headers track identity, checkpoints, and history. |
pg_control, checkpoint records, page headers, and backup labels serve related, not identical, purposes. |
| Log organization | Each RAC instance has a redo thread. Circular log groups can have multiplexed members. | One primary generates a WAL stream in segment files, with no built-in redo-member multiplexing. |
Neither engine recovers by rerunning the original SQL. During normal execution, Oracle creates redo change vectors before applying changes to buffered blocks. PostgreSQL, by contrast, typically modifies buffered pages and then inserts the corresponding WAL record within the same critical section. Both enforce write-ahead ordering before dirty blocks or pages are written to persistent storage. During recovery, Oracle applies change vectors, while PostgreSQL dispatches WAL records to resource-manager redo routines. Both replay changes to buffered blocks or pages, although not every log record describes a page modification. PostgreSQL’s page LSN lets replay skip changes already applied to a page. Transactions span many records, and multi-block structural changes must also remain crash-consistent.
There are exceptions to logging. Oracle NOLOGGING can leave loaded data out of redo during eligible direct-path operations. PostgreSQL UNLOGGED tables, introduced in 9.1, are truncated after a crash, and their contents are not physically replicated. Neither mechanism allows missing data to be reconstructed later from redo. Temporary data also falls outside the usual recovery process for persistent tables. Before Oracle 12c, DML on temporary tables generated redo to protect undo.
Checkpoints and backups
A checkpoint marks a safe position to recover from. Oracle's incremental checkpoints advance this position in the control file without updating every datafile header. A datafile may be fuzzy: its blocks do not have to match the checkpoint in its header or reflect a single moment in time.
Since PostgreSQL 8.3, checkpoint writes have been spread over time. When a checkpoint completes, PostgreSQL publishes the checkpoint's earlier REDO starting position through WAL and pg_control. This differs from Oracle's continuously advancing recovery position. During recovery, PostgreSQL uses restartpoints to make replay progress durable.
User-managed hot backup behavior is also recognizable. BEGIN BACKUP holds the datafile header checkpoint in place while ordinary block writes continue. Whole-block redo protects against fractured blocks during an external file copy, but it does not freeze the file. END BACKUP ends the mode. RMAN online backups do not require putting datafiles in backup mode.
PostgreSQL introduced physical online backup and PITR in 8.0, in 2005. Its backup label records the recovery starting point. It does not freeze an Oracle-style file-header checkpoint. Full-page WAL images also protect against torn pages, but they are normally generated for the first page modification after each checkpoint—not only during a backup. Online backup forces this protection even when full_page_writes is off. The page-LSN test still applies, so this does not mean a full-page image is generated for every update. In both systems, recovery must apply enough history to make the backup consistent before opening it. An arbitrary point during the copy is not necessarily a valid recovery endpoint.
PostgreSQL added built-in incremental base backups in version 17, released in 2024. WAL summaries identify changed blocks, and pg_combinebackup rebuilds a full backup before recovery. The goal is similar to RMAN incrementals, but the implementation differs.
Oracle cannot reuse a redo group that is still needed for instance recovery or archiving. PostgreSQL retains WAL for recovery, archiving, replication slots, and other consumers. Checkpoint progress does not permit discarding history that a backup or replica still needs.
Instance recovery and media recovery
Instance recovery starts from current files after memory is lost. Media recovery repairs damaged files or rolls older copies forward. Logical mistakes, such as a committed deletion, are a third problem: replaying all redo faithfully reproduces them.
Media recovery does not mean archived redo only. An older restored datafile can need archived redo, online redo, or both.
Oracle can recover an offline datafile while the rest of the database stays open. Clean offline/read-only files can have their own recovery boundaries. File identity, creation/drop history, and dictionary/catalog state must match the selected endpoint; a filename alone is not sufficient.
RMAN can even recreate an unbacked-up datafile given the required logged history. PostgreSQL's normal physical recovery starts from a base backup. Neither engine can invent unlogged data.
Process failure is another boundary. Oracle's PMON group can clean up a failed process without restarting the instance. PostgreSQL treats an error inside a critical page-modification section as a PANIC: discard shared-memory state and perform instance-wide crash recovery. Neither process cleanup nor this restart should be confused with repairing a damaged on-disk block.
RESETLOGS and timelines
RESETLOGS starts a new Oracle incarnation and resets log sequence numbers. RMAN can recover an ancestor backup through it given the redo path and metadata, already documented in Oracle 10g Release 1.
Recovery follows the selected branch, not transactions discarded by PITR.
PostgreSQL has tracked these branches as timelines since 8.0. An older base backup can recover into a descendant timeline if it has the WAL and history files. Incarnations and timelines are analogous histories, not interchangeable metadata.
Restoring an Oracle backup control file is a separate case requiring recovery and RESETLOGS. Neither clearing Oracle redo nor using pg_resetwal reconstructs lost changes. The latter is a last-resort salvage tool for damaged WAL/control metadata, not PostgreSQL's equivalent of OPEN RESETLOGS.
RAC and multi-node architectures
Cache Fusion, documented in Oracle9i, replaced disk-mediated block transfers with direct dirty-block transfers between instances. Past images and merging redo from failed instances allow recovery without assuming every transferred block first reached disk.
RAC coordinates instance-local SGAs through global cache and enqueue services, allowing multiple read-write instances to share one database. Cache coherence, locking, and transaction coordination extend across nodes.
PostgreSQL's shared memory, roughly equivalent to an Oracle instance's SGA, is confined to a single node. There is no global cache or cross-node lock or transaction manager. Scaling writes out requires sharding through the application or an extension like Citus; in either case, the application doesn't see a single global database.
Two other architectures distribute database workloads. Neither is RAC, but both expose a single PostgreSQL-compatible logical database:
- Distributed SQL, such as YugabyteDB, stores shared database state in a horizontally sharded storage and transaction layer. This includes data, MVCC versions, transaction status, and write intents. Multiple SQL nodes can write without requiring the application to know where the data is located, while session and query-execution state remain local.
- Disaggregated storage, such as Azure HorizonDB, offloads durable state and its maintenance separately from compute. Shared buffers, locks, and transaction execution remain local to each compute node, with a single writer. Offloading page persistence, full-page writes, and checkpoint work frees the writer to handle more SQL. Storage and read capacity scale out. The writer still scales up.
Microsoft provides an example of applying disaggregated storage to both its commercial engine, SQL Server, and PostgreSQL-compatible HorizonDB. SQL Server already has mature recovery capabilities, and Azure SQL Database supports multitenant deployments with independently recoverable databases and shared compute through elastic pools. Azure SQL Database Hyperscale's Socrates architecture, published in 2019, separates compute, log services, and page storage. Microsoft describes HorizonDB's storage design as similar to Socrates. The recovery connection is concrete: its storage services handle WAL replication and archiving, and page servers reconstruct pages from WAL. Compute nodes no longer need to replay WAL to recover persistent pages at startup.
Standby databases
Oracle Data Guard ships redo to a separate database copy. A physical standby applies it. PostgreSQL's physical standbys belong in this comparison, not the RAC one. Streaming replication and read-only hot standby arrived in 9.0, in 2010. Standbys support failover and read offloading, not multiple writers sharing a global buffer cache.
pg_rewind, added in 9.5 (2016), helps rejoin a diverged copy. It copies changed blocks from another server and then replays WAL. Unlike Flashback Database, it does not reverse local changes using retained before-images.
Recovery scope and Flashback
Recovery now offers finer scopes: individual blocks, tables, tablespaces, and PDBs. Oracle block media recovery can repair persistent blocks with the datafile online. Core PostgreSQL has no corresponding built-in block media recovery command.
Flashback Query uses retained undo to query earlier row versions. Flashback Database uses flashback logs and redo to rewind without restoring datafiles from backup.
Core PostgreSQL has no built-in equivalent. The historical direction is almost reversed: POSTGRES originally supported historical queries, but time travel was removed in 6.2, in 1997, because of performance and storage costs. MVCC row versions are not automatically a queryable history: VACUUM can reclaim them.
RMAN table recovery automates auxiliary-database PITR followed by Data Pump export/import.
PostgreSQL's built-in physical PITR restores the whole cluster: targets select when, not which objects. Retrieving one table typically means recovering a separate cluster and exporting/importing it, without an RMAN-style table-recovery command. Separately, logical backups allow selected-table restores with pg_restore, but only to the state captured in the dump, not an arbitrary PITR target.
The consistency question remains: restoring one table to yesterday while related tables stay at today can break application relationships.
Checksums, parallel recovery, and diagnostics
Checksums detect damage. They do not repair it. Oracle has checksums for data blocks and redo. PostgreSQL has WAL CRCs and data-page checksums. Redundant logs, backups, and usable history remain necessary.
Oracle supports parallel instance recovery and parallel media recovery. PostgreSQL 18 applies physical WAL in a single startup process. Prefetching can overlap reads but cannot parallelize redo application.
Oracle's V$LOG, V$DATAFILE_HEADER, V$RECOVER_FILE, and V$BACKUP expose different parts of recovery state. PostgreSQL provides WAL/replay statistics, pg_controldata, and pg_waldump. These are inspection tools, not proof that arbitrary combinations of files and logs form a recoverable database.
Conclusion
Oracle7 was already known for robustness and performance under demanding OLTP workloads. Much of the durability architecture Oracle relies on today was in place 30 years ago. Since then, the work has largely extended that foundation by shortening recovery times, automating administration, repairing smaller parts of the database, and coordinating work across more nodes. That breadth comes at a cost: Oracle has become an extremely complex system, with many recovery paths, components, and interactions to understand.
POSTGRES started with a different priority. In The Design of the POSTGRES Storage System (1987), Michael Stonebraker described the first goal as:
"to provide transaction management without the necessity of writing a large amount of specialized crash recovery code."
This referred to the original no-overwrite design, not the WAL-based PostgreSQL used today. The reasoning still matters: minimizing recovery code was itself a reliability goal. A community-driven open-source project depends on simplicity and extensibility to remain sustainable.
PostgreSQL is not new either. It has powered critical production systems for many years. Its broader adoption, particularly through managed cloud services, has brought more deployments with operational requirements that Oracle users have long been familiar with. For example, features such as incremental base backups have addressed some of the gaps.
For the capabilities compared here, Oracle has the more complete built-in recovery toolset: finer-grained repair scopes, Flashback, and parallel redo application. RAC adds a multi-writer architecture that core PostgreSQL lacks. These are real differences, but they do not mean PostgreSQL's synchronous commits offer a weaker basic durability guarantee. The main gaps lie in recovery options, availability, and the effort required to meet a recovery objective—not in correctly recovering committed transactions. When PostgreSQL lacks certain optimizations, cloud-managed services can rely on scalable, cloud-native storage for durability and recovery.
The choice is about more than recovery features. Users also value open source and the freedom to choose where and how their databases run. Managed services like HorizonDB use horizontally scalable, resilient storage for durability and page recovery, rather than replicating Oracle's recovery machinery in PostgreSQL. This shifts where recovery work happens and improves performance predictability and high availability. From an application point of view, it's still PostgreSQL, so that freedom remains.
Thirty years on, this is still what I enjoy about databases: foundations laid decades ago continue to evolve into systems that are easier to operate, faster, more available, and better for building applications.