MS SQL Perofrmance issue with T-sql

Please find the screenshot and suggest us how to fine tune: This is SQL Server 2016
Who is Participating?
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.

Daniel_PLDB Expert/ArchitectCommented:

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.

Jim HornSQL Server Data DudeCommented:
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'.
VijayAuthor Commented:
----This is the Query---

WITH [CTEOrderedUpdate]
			SELECT TOP(@MaxRows)
			  [dbo].[BlobMigrationQueue] WITH(ROWLOCK, UPDLOCK, READPAST,Index=IX_BlobMigrationQueueGet)
			  [Step] = 0 AND
			  [Failed] = 0 AND
			  [StepInProgress] = 0
			[StepInProgress]  = 1,
			[AgentName]         = @AgentName,
			[ProcessCount]    = [ProcessCount] + 1,
			[DateStarted]     = SYSDATETIME(),
			[DateFinished]    = NULL

Open in new window

Your Guide to Achieving IT Business Success

The IT Service Excellence Tool Kit has best practices to keep your clients happy and business booming. Inside, you’ll find everything you need to increase client satisfaction and retention, become more competitive, and increase your overall success.

Pawan KumarDatabase ExpertCommented:
How much time the query is taking ?

The query is using an index but that index does not cover all the column the query needs so the query will have to go for that extra column using keylookup 50001 times which looks like an issue. If possible add(include) that extra column in that in that index itself so that we can ignore this key lookup part. Meaning we will get all the data at one place and do not have to traverse to get the additional data.

Also why we are specifying so many locks and an Index..(forced)
 [dbo].[BlobMigrationQueue] WITH(ROWLOCK, UPDLOCK, READPAST,Index=IX_BlobMigrationQueueGet)

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
VijayAuthor Commented:
Thank you
VijayAuthor Commented:
Thank you Pawan.
We found the solution.
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

From novice to tech pro — start learning today.