Question

Is it possible to execute a simple query against a Db but 100 of it at the same time, in parallel via TSQL in Management Studio? (The idea is to see how it impacts the Db server in terms of performance)

Was it helpful?

Solution 2

You can use sqlcmd and put it in a batch to spawn 100 parallel processes. As an alternative you can use LinqPad and a simple C# script that uses Tasks and, too, spawns 100 processes.

If you want to have a parallel stored procedure execution, then you need to setup service broker and a queue with the length of 100, but you won't be having exactly 100 parallel activations at once because service broker adds workers as workload increases, so it won't happen instantaneously.

OTHER TIPS

you can execute your batch in a loop like in

select getdate()
go 100

it will not execute in parallel but 100 times one after another. if this is not enough, you can execute it in the same time in another session

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top