I am at a "dead end" with my powershell script. It executes correctly but it takes to long to execute. (about 7days since it does millions of DML operations on a SQL Server Database).
Problem is the 7 days it takes isn't acceptable and i need to reduce it to 2 days at max...
Can anyone point me on where i can start looking to solve this?
Would post the whole code but its around 600 lines.
It's probably not possible to give you specific advice without the code, and for a 600-line script, it's going to be difficult for a volunteer to find that kind of time ;).
Do you think that it's mainly the SQL portion that's causing the long time? If so, that's really a query optimization or SQL Server optimization problem, and this isn't probably the right place to find answers for that. It could be anything from a poorly designed schema, to badly designed indexes, to indexes needing maintenance, to a thousand other things.