Sybase 12.4.2 User Manual

Page of 536
Checkpoints, savepoints, and transaction rollback
304
 
Adaptive Server IQ relies on three transaction-related commands that help you 
recover a stable set of data in the event of system or media failure. These 
commands set checkpoints, set and release savepoints, and roll back 
transactions.
Checkpoints 
checkpoint marks a significant point in a transaction, when Adaptive Server 
IQ writes to disk certain information it tracks internally. It uses this information 
in the event you need to recover your database.
Adaptive Server IQ uses checkpoints differently than OLTP databases such as 
Adaptive Server Anywhere. OLTP databases tend to have short transactions, 
that affect only a small number of rows. It would be very expensive for them 
to write entire pages to disk. Instead, OLTP databases generally write to disk at 
checkpoints, and write only the changed data rows. 
As discussed in Chapter 1, “Overview of Adaptive Server IQ System 
Administration”, Adaptive Server IQ is an OLAP database. A single OLAP 
transaction can change thousands or millions of rows of data. For this reason, 
Adaptive Server IQ does not wait for a checkpoint to occur to perform physical 
writes. It writes updated data pages to disk after each transaction commits. For 
an OLAP database, it is much more effective to write full pages of data to disk 
than to write small amounts of data at arbitrary checkpoints.
Checkpoints aid in recovery
In order to recover from a system or media failure, Adaptive Server IQ must be 
able to restore the database to a point where it is internally consistent. IQ uses 
checkpoints to generate reference points and other information that it needs to 
recover databases. The information that IQ writes to disk at each checkpoint is 
essential to the recovery process.
When checkpoints occur
Most Adaptive Server IQ checkpoints occur automatically. You can also set 
explicit checkpoints, although you do not need to do so.
A checkpoint occurs at the following times:
When a transaction issues a 
CHECKPOINT
 command.
When the 
CHECKPOINT_TIME
 is exceeded.