Set the isolation level

Each connection to the database has its own isolation level. In addition, the database can store a default isolation level for each user or group. The PUBLIC setting of the isolation_level database option enables you to set a single default isolation level for the entire database group.

You can also set the isolation level using table hints, but this is an advanced feature that should be used only when needed.

You can change the isolation of your connection and the default level associated with your user ID by using the SET OPTION statement. If you have permission, you can also change the isolation level for other users or groups.

 Set the isolation level for the current user

If you want to use snapshot isolation, you must first enable snapshot isolation for the database.

  • Execute the SET OPTION statement. For example, the following statement sets the isolation level to 3 for the current user:

    SET OPTION isolation_level = 3;
 Set the isolation level for a user or group

If you want to use snapshot isolation, you must first enable snapshot isolation for the database.

  1. Connect to the database as a user with DBA authority.

  2. Execute the SET OPTION statement, adding the name of the group and a period before isolation_level. For example, the following statement sets the default isolation for the PUBLIC group to 3.

    SET OPTION PUBLIC.isolation_level = 3;
 Set the isolation level just the current connection

If you want to use snapshot isolation, you must first enable snapshot isolation for the database.

  • Execute the SET OPTION statement using the TEMPORARY keyword. For example, the following statement sets the isolation level to 3 for the duration of the current connection:

    SET TEMPORARY OPTION isolation_level = 3;
 Default isolation level
 See also