Link to home
Start Free TrialLog in
Avatar of Vijay
Vijay

asked on

MS SQL Perofrmance issue with T-sql

Please find the screenshot and suggest us how to fine tune: This is SQL Server 2016
User generated image
Avatar of Daniel_PL
Daniel_PL
Flag of Poland image

Hi,

You didn't provide us with the query. Basing on this screen only you are querying columns which are not included in an index and index has been choosen, therefore even if it has clusterd index key values in its leafs SQL is looking to PK for other columns.
Modify your index accordingly by adding columns (main or included - depends on query which we don't see) or create new covering index if query is worth doing that - is being frequently executed etc.

Regards,
Daniel
Avatar of Jim Horn
Please tell us on what basis you believe we can answer your question without seeing the code that generated it, the schemas of the queried tables, or a full execution plan:   Mind reading, Seance, or 'The Force'.
Avatar of Vijay
Vijay

ASKER

----This is the Query---

WITH [CTEOrderedUpdate]
		  AS
		  (
			SELECT TOP(@MaxRows)
			  [Uid],
			  [AgentName],
			  [Step],
			  [StepInProgress],
			  [ProcessCount],
			  [DateStarted],
			  [DateFinished]
			FROM
			  [dbo].[BlobMigrationQueue] WITH(ROWLOCK, UPDLOCK, READPAST,Index=IX_BlobMigrationQueueGet)
			WHERE
			  [Step] = 0 AND
			  [Failed] = 0 AND
			  [StepInProgress] = 0
		  )
		  UPDATE
			[CTEOrderedUpdate]
		  SET
			[StepInProgress]  = 1,
			[AgentName]         = @AgentName,
			[ProcessCount]    = [ProcessCount] + 1,
			[DateStarted]     = SYSDATETIME(),
			[DateFinished]    = NULL
		  OUTPUT
			inserted.[Uid]
		  INTO
			@Batch([Uid])

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Vijay

ASKER

Thank you
Avatar of Vijay

ASKER

Thank you Pawan.
We found the solution.