Interactive simulator for testing and visualizing SQL Server isolation level behaviors under concurrent transactions.
- Simulates concurrent database transactions
- Demonstrates:
- Dirty Reads
- Non-repeatable Reads
- Phantom Reads
- Deadlocks
- Visualizes the impact of different isolation levels
- Calculates execution time and logs deadlock status
- Read Uncommitted
- Read Committed
- Repeatable Read
- Serializable
This project uses the AdventureWorks2022 sample database to simulate real-world concurrent transactions.
π‘ Please download and restore the
.bakfile in your SQL Server instance before running the simulation.
π₯ Download AdventureWorks2022.bak
(Official link from Microsoft SQL Server Samples)
- Open SQL Server Management Studio (SSMS)
- Right-click
DatabasesβRestore Database - Select the
.bakfile and restore it asAdventureWorks2022
- C# (.NET Framework) β UI and transaction simulation logic
- SQL Server β For executing concurrent transactions
- ADO.NET β Database access and command execution
- Windows Forms β User interface
- Multithreading β Simulating parallel operations
- Visual Studio 2019 or newer
- SQL Server (Express or LocalDB)
- AdventureWorks2022 sample database
- Clone the repository:
git clone https://github.com/your-username/SqlIsolationLevelsSimulator.git-
Open
SqlIsolationLevelsSimulator.slnin Visual Studio -
Make sure SQL Server is running and the
AdventureWorks2022database is restored -
Update
App.configif needed:
<connectionStrings>
<add name="DefaultConnection"
connectionString="Data Source=localhost;Initial Catalog=AdventureWorks2022;Integrated Security=True" />
</connectionStrings>- Run the app with F5
- Isolation Level: Repeatable Read
- Transaction A: Update operation
- Transaction B: Select β Delay β Select again
- β Deadlock: No
- β± Execution Time: 426 ms
Esma Εen
- π§ [email protected]
- π GitHub