Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table locked during inserts... website unusable (sql server 2008)

I have a background process that is constantly inserting into a table in real-time. It could be thousands of inserts an hour (with a few updates). This same table is used by the web application to get some data needed to display to the user.

Currently whenever the background process runs its inserts/updates, the web app seems blocked and cannot access the database.

I'm wondering what a good solution could be. Should I create another table where I insert into and than copy the table over to another table that is read only? Is there another method?

Any help and suggestions is greatly appreciated!

like image 726
rksprst Avatar asked Jul 02 '26 09:07

rksprst


1 Answers

Especially for SQL Server you might want to change your database to turn READ_COMMITTED_SHAPSHOT on.

This basically prevents your select queries from locking up if there are pending inserts/updates on the data.

like image 66
Wolfgang Avatar answered Jul 05 '26 00:07

Wolfgang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!