Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server Stored Procedures: do they queue up?

I should probably be able to find an answer to this but my Google-fu is weak today. When I have the same stored proc called multiple times by a web app, do the calls queue up or do they run independently?

like image 783
Valkyrie Avatar asked Dec 10 '22 19:12

Valkyrie


1 Answers

Depends on the isolation level of what the stored procedure is doing. If the isolation level is set to READ UNCOMMITTED for all the transactions in the SP, there is no protection, and multiple threads can be performing the same transaction at the same time.

If it's set to a higher isolation level, then other threads may be locked out of the resources that your SP is dealing with until the transaction is completed, effectively "queuing" the other SP threads.

There is no explicit stored procedure queue though. As long as your database has free connections and resources available, it will spawn threads to satisfy requests.

like image 126
womp Avatar answered Dec 23 '22 19:12

womp