sql008 to monitor batch job performance

Hi,
Can someone tell me how do I monitor the performance of this sql jobs with script below? basically I would like to know how long it takes to complete the batch at 1000 ?  I maybe will increase it until we satisfy with the performance

DECLARE @i INT
WHILE 1 = 1 BEGIN
     BEGIN TRANSACTION
      DELETE TOP(1000)
      FROM DB_Table  where timestamp < getdate() -185

      SET @i = @@ROWCOUNT
      commit transaction
      IF @i = 0 BREAK
      --PRINT '# of Records deleted in batch ---- ' + CAST(@i AS VARCHAR(10))
END
GO
motioneyeAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AnujSQL Server DBACommented:
The performance really depends on the tables and index structure, because it needs to update index structure too.

if you need to know the history details of the job then check job history by right clicking the job and go to view history, this has the details regarding duration, last run status etc. You can also get the same details from msdb too.

If you need more details like cpu time, i/o usage, locks and blocks then its recommended to use SQL Server profiler. Start SQL Server profiler, then run the job and this will capture the statement level details of the job. You can customize the Trace file to get more details.



0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.