Powershell execution time

This topic contains 2 replies, has 3 voices, and was last updated by Profile photo of Don Jones Don Jones 1 year ago.

  • Author
  • #30589
    Profile photo of Arestas

    Hello all,

    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.



  • #30596
    Profile photo of Mark

    The first thing to determine if the time is taken up by the PowerShell script itself or if the script is waiting for the SQL commands to complete. Is the SQL server/database the bottleneck.

    It may also be the type of SQL command used, INSERT vs BULK INSERT
    In SELECT statements, are some of the key variables indexed?
    Those would also be factors.

  • #30597
    Profile photo of Don Jones
    Don Jones

    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.

You must be logged in to reply to this topic.