Performance improvement without a clustered index

I have a query in which index search (without clustering) takes more time about 93% of the total execution time.

query execution plan, the estimated number of rows to search for the index is 1, and the actual number of rows is 209. is this a problem?

How to improve search performance without clustering. A general answer would be helpful.

Execution plan: enter image description here

And the following query:

SELECT TOP 11 DVPR1.IncidentID, DVPR2.IncidentID, Rel.ID, PER1.[LastName], PER1.[FirstName] FROM DV_PHPersonalRecord DVPR1 INNER JOIN Relationship Rel ON Rel.source_Id = DVPR1.RowId AND Rel.typeCode = 'RPLC' INNER JOIN DV_PHPersonalRecord DVPR2 ON DVPR2.RowId = Rel.target_Id INNER JOIN [T_Attribute] (nolock) ON [T_Attribute].[ActRelationship_ID] = Rel.[ID] AND [T_Attribute].[name] = 'MergeFlag' AND ( [T_Attribute].[valueString_Code] = 'pending') INNER JOIN [Person] PER1 (nolock) ON DVPR1.[PersonDR]=PER1.[RowID] INNER JOIN [Person] PER2 (nolock) ON DVPR2.[PersonDR]=PER2.[RowID] WHERE DVPR1.TypeDR = 718990 AND (PER1.[Code_ID] IS NULL OR ( PER1.[Code_ID] = '6516' AND PER1.[OptionsCode_ID] = '6522') ) AND ( PER2.[Code_ID] IS NULL OR ( PER2.[Code_ID] = '6516' AND PER2.[OptionsCode_ID] = '6522') ) ORDER BY PER1.[LastName] ASC, PER1.[FirstName] ASC 
+6
source share
1 answer

When I see such a mismatch between the expected rows and the actual rows, I will first look at updating the statistics of all the tables involved.

The query optimizer should do this automatically, but ... sometimes it benefits.

This usually requires DBA type permissions.

Check out the Microsoft Update Statistics page.

http://msdn.microsoft.com/en-us/library/ms187348.aspx

+12
source

Source: https://habr.com/ru/post/913601/


All Articles