Using delayed_commit to determine when log records are committed

A relational database is required to ensure a number of transaction properties, including atomicity, consistency, integrity and durability (known as the ACID properties). To ensure this, Adaptive Server adheres to the following rules; it:

set delayed_commit is a performance option suitable only for certain applications. It increases Adaptive Server performance for data manipulation language (DML) operation, (for example, insert, update, delete), but increases the risk of losing your data during a system failure. Performance gains depend on the application in use.

The types of applications that benefit from set delayed_commit typically include short transactions that are sent rapidly and serially to Adaptive Server. For example, a batch application that issues many insert statements, with each insert being a separate transaction.

Use the set command to enable delayed_commit for a session, or with sp_dboption for the database.

After you enable set delayed_commit, the client application is notified of a successful commit before the corresponding log records are written to disk. This improves performance because all but the last log page are written to disk, alleviating contention on the last and active log page.

Before you enable set delayed_commit, consider:

Changes to logging behavior

These are the changes to logging behavior when delayed_commit is enabled.

When a session implicitly or explicitly commits a transaction:

Risks of using delayed_commit

When set delayed_commit is enabled, Adaptive Server notifies the client application before the actual physical disk write completes. Because of this, the application perceives that the transaction is complete whether or not the physical disk write is successful. In the event of a system failure (disk errors, system crash, and so on), transactions that were not written to disk (transactions whose commit records were on the last log page) are not present after recovery in spite of the application being notified they were committed.

Systems that require tight system interdependencies, such as through a messaging system using Real Time Data Services (RTDS), further complicate the consequences of using set delayed_commit.

There are two situations where applications can manage the risk:

Enabling set delayed_commit

You can enable set delayed_commit for a database or for a session, with the session setting overruling the database setting. This means that a session that enables the option has delayed_commit enabled regardless of the database setting.