An efficient logging method and system is disclosed that can be used to
recover from a failure in a transaction system. It is based on a
differential logging scheme that allows commutative and associative
recovery operations. The method includes the steps of taking a
before-image of the primary database in main memory before an update to
the primary database; taking an after-image of the primary database after
the update; generating a differential log by applying bit-wise
exclusive-OR (XOR) between the before-image and the after-image; and
performing either a redo or undo operation by applying XOR between said
one or more logs and the before-image. Since XOR operations are
commutative and associative, correct recovery is possible regardless of
the creation sequence of log records. The present invention improves the
performance of a logging system by reducing the size of log records and
by allowing parallel execution of recovery operations.