I'm currently doing the following in a ReadUncommitted
transaction on mulitple thread, in a an old system:
- Each thread get a unique set of data to work on. There are never duplicates across these threads.
- The threads gather data from a bunch of tables (only reads) for their unique data set.
- Based on the gathered data each thread create n number of new entities, Emails, in memory for later writing.
- Then for each email entity the threads have to check if the email entity already exists in the table, to avoid duplicates. This involves comparing x number of columns.
- Afterwards the threads write the email entities which do not already exist, knowing that they will be clean inserts ALWAYS as the threads and this application are the only ones who can write these type of email entities and the threads always work on unique data sets.
- Then the threads commit.
Now I KNOW this is not a pretty design, but it's to big a task to refactor the entire system. The reason for the threading is purely to gain better performance.
My question is:
- Are there any dangers in using the
ReadUncommitted
isolationlevel in my case?
I've been reading up on isolation levels again and again, lately, just to make sure, but I'm not that experienced with SQL Server yet.
Edit: I should mention that the reason for switching to using the ReadUncommitted
isolation level was that I wanted the threads to be able to commit simultaneously, for optimal performance.