I have a CLR
process which runs under SQL Server2008
. It builds a cache of several tables data to hold in a static class for use later by other calls.
My question is could I improve the process of loading this cache by spawning threads to load each data set/ table in my cache?
I've steared clear of this in the past as various posts have suggested leave the thread management to SQL Server
. However I could really do with speeding up this process.
Currently its a sequential process to load each data set. If I could run these concurrently it would be very handy. A process I've done many atime outside of the CLR
cover to get some extra performance gains.
Any ideas help tips very much appreciated.
You can use threads, but they must behave. Otherwise you'll lose the benefits of using them.
From the CLR Host Environment
How SQL Server and the CLR Work Together
Static data shared across invocations - not a good plan for CLR calls: SQL Server documentation