Vijay
asked on
MS SQL Perofrmance issue with T-sql
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'.
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])
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you
ASKER
Thank you Pawan.
We found the solution.
We found the solution.
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