Skip to main content

Hi We have a customer which is asking if sql DB Snapshot isolation is supported by Alliance (i think not ) but i wanted to have an official answers on this.

Thanks for your feedback

Rgds

Christophe

Hi Christophe,

 

Short answer: No, it is not set up for snapshot isolation.

 

Longer explanation:

If you run this query for the database in question, you can see that it is turned off.

SELECT 
    name AS DatabaseName,
    snapshot_isolation_state_desc,
    is_read_committed_snapshot_on
FROM 
    sys.databases
WHERE 
    name = 'YourDatabaseName';

You should see a result like:

DatabaseName snapshot_isolation_state_desc is_read_committed_snapshot_on
YourDatabaseName OFF

1

 

The SQL transaction scripts must be modified to use the isolation snapshot which the Alliance scripts do not have these defined at all.  An example of such a transaction would be:


-- Set the isolation level to Snapshot
SET TRANSACTION ISOLATION LEVEL SNAPSHOT;

BEGIN TRANSACTION;

-- Your SQL operations here
SELECT * FROM Orders WHERE CustomerID = 123;

-- You can perform updates too
UPDATE Orders SET Status = 'Processed' WHERE OrderID = 456;

COMMIT;

I have never seen this in any of the scripts retrieved from transactions out of Alliance so I am confident this is not directly supported and would need development for it to be specifically used.

Please consider that this also poses its own risks if enabled such as:

  1. Increased TempDB usage as the rows versioned for the transactions have to be stored somewhere.  Resources will increase.
  2. Update Conflicts… say you have two transactions using isolation and one leads to an update… you will get conflicts if the second process also tries to update their row.  This has to be handled very carefully.
  3. Long-Running Transaction that stay open for a long time retain row versions potentially blocking version cleanup as well as increasing TempDB pressure.
  4. Complex Debugging as it becomes hard to debug when the data has changed since the transaction started.

 

Hope this helps.

 


Reply