What are the considerations when using SERLIALIZABLE over READ COMMITTED isolation level in Oracle

isolation-leveloracle

What are the considerations when using SERIALIZABLE isolation level over the default READ COMMITTED in an Oracle database?

Given the concurrency system used within Oracle (using transaction logs to determine the state of the database at a point in time), I understand that using a SERIALIZABLE transaction does not decrease the availability of the database over READ COMMITTED isolation.

One consideration is that there must be enough space allocated for undo segments to allow the database to store enough history to accommodate the implied extra time required to support transaction-level over statement-level read consistency. If there is not enough undo data, there is a risk of error ORA-01555 Snapshot Too Old (although this is still an risk with a READ COMMITTED query).

One point that I am not clear on is if there are any performance implications of serializable isolation. Is there any extra cost associated with, for example, having to go potentially further back in the undo data to return the records?

Finally, as I am talking about a read-only transaction the assumption is that there is no risk of a ORA-08177: Cannot serialize access for this transaction from writing to data which has since been updated.

Best Answer

Is there any extra cost associated with, for example, having to go potentially further back in the undo data to return the records?

Example:

You have a table getting one insert every minute.

If a SERIALIZABLE transaction started at 4:00pm, and queried that table at 4:15pm, then it will have to read at least 15 undo records to return to the state of the table when your transaction started. If there had been no activity on the table, then there would be no additional workload.

Ultimately it would depend on how long the serializable transaction last, and what changes are made to the data it looks at during that time.

I'd add that it is rare to see SERIALIZABLE used. The same mechanisms support DBMS_FLASHBACK with the advantage that you can specify the exact time for which you want to view the data (eg Closing balance at 5pm).