Starting a Transaction with SNAPSHOT Isolation Level

From InterBase
Jump to: navigation, search

Go Up to Isolation Level


InterBase assumes that the default isolation level for transactions is SNAPSHOT. Therefore, SNAPSHOT need not be specified in SET TRANSACTION to set the isolation level. For example, the following statements are equivalent. They both start a transaction, t1, for READ WRITE access and set isolation level to ­SNAPSHOT.

EXEC SQL
SET TRANSACTION NAME t1;
EXEC SQL
SET TRANSACTION NAME t1 READ WRITE SNAPSHOT;

When an isolation level is specified, it must follow the access and lock resolution modes.

Tip: It is good programming practice to specify an isolation level of a transaction, even when it is SNAPSHOT. It makes a source code of an application easier to read and debug because the intentions of the program are clearly spelled out.