I am having a SP that is doing a select union of many tables with no lock. This will do lot of calculations with many groupings and sumation and so will take about 2 min for its run. I need to run this for about 500 different set of data. So It totally takes about 1000 min.
To reduce this I need to run this calculation in parallel. So if i run for 4 set of data in parallel I should be done in about 250 min.
But the problem is that once i am done with this calculations I get a set of data that i need to store into a table which has some primary key constraints on 4 of its columns. So when running in parallel I am expecting some dead lock issues. So I was thinking of writing this data to a temporary table that will have the same columns but with no primary key or any constraints.
So with this I am expecting there should be no dead lock. Please advice in this regards and let me know if my understanding is right. Thank you.