Automatic Housekeeping

From InterBase
Jump to: navigation, search


If a transaction is left in an active (unresolved) state, this is an “interesting” transaction. In a given transaction inventory of a database, the first transaction with a state other than committed is known as the Oldest Interesting Transaction (OIT). Automatic housekeeping occurs when the difference between the OIT and the oldest active transaction (OAT) is greater than the sweep interval. By default, this sweep interval is 20,000, but it is configurable (see Setting the Sweep Interval).

Note: It is a subtle but important distinction that the automatic sweep does not necessarily occur every 20,000 transactions. It is only when the difference between the OIT and OAT reaches the threshold. If every transaction to the database is committed promptly, then this difference it is not likely to be great enough to trigger the automatic sweep.

The InterBase server process initiates a special thread to perform this sweep asynchronously, so that the client process can continue functioning, unaffected by the amount of work done by the sweep.

Tip: Sweeping a database is not the only way to perform systematic garbage collection. Backing up a database achieves the same result, because the InterBase server must read every record, an action that forces garbage collection throughout the database. As a result, regularly backing up a database can reduce the need to sweep. This enables you to maintain better application performance. For more information about the advantages of backing up and restoring, see About InterBase backup and restore options.