I have question on lock on table in SQL Server while inserting data using multiple processes at a single time into same table.
Here are my questions on this,
Please help me to understand the same.
Is it default behavior of SQL server to lock table while doing insert?
No. SQL Server by default locks by row - so new rows being inserted are locked - but not the whole table.
This will change if you insert more than 5000 rows in a single transaction. In that case, keeping that many individual locks just becomes too much and SQL Server will do a lock escalation and lock the entire table instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With