Hi,
Is there any way to control(Enable/Disable) the Table hints (NOLOCK, NOEXPAND) used in Kentico Queries ? The below query doing 10K Logical Reads with using NOEXPAND on View_CMS_Tree_Joined but it only does 18 when not using NOEXPAND. I don't have any idea when this particular query is created and executed but it raises issues with the DBA's, also this is a Kentico Project upgrades from 8 to 9 and it seems the DB has no problems with the indexes on that view.
SELECT [NodeID], [NodeAliasPath], [NodeName], [NodeParentID], [NodeClassID], [NodeLevel], [NodeHasChildren], [NodeLinkedNodeID], [DocumentID], [DocumentName],
[DocumentCulture], [DocumentModifiedWhen], [DocumentMenuRedirectUrl], [ClassName], [DocumentType], [DocumentIsArchived],
[DocumentPublishedVersionHistoryID], [DocumentWorkflowStepID], [DocumentCheckedOutByUserID], [DocumentCheckedOutVersionHistoryID],
[DocumentCanBePublished], [DocumentPublishFrom], [DocumentPublishTo], [DocumentIsWaitingForTranslation], [DocumentMenuRedirectToFirstChild], [NodeACLID],
[NodeSiteID], [NodeOwner]
FROM ( SELECT [NodeID], [NodeAliasPath], [NodeName], [NodeParentID], [NodeClassID], [NodeLevel], [NodeHasChildren], [NodeLinkedNodeID], [DocumentID],
[DocumentName], [DocumentCulture], [DocumentModifiedWhen], [DocumentMenuRedirectUrl], [ClassName], [DocumentType], [DocumentIsArchived],
[DocumentPublishedVersionHistoryID], [DocumentWorkflowStepID], [DocumentCheckedOutByUserID], [DocumentCheckedOutVersionHistoryID],
[DocumentCanBePublished], [DocumentPublishFrom], [DocumentPublishTo], [DocumentIsWaitingForTranslation], [DocumentMenuRedirectToFirstChild],
[NodeACLID], [NodeSiteID], [NodeOwner],
ROW_NUMBER() OVER ( PARTITION BY NodeID ORDER BY CASE WHEN [DocumentCulture] = @DocumentCulture THEN 1
ELSE 2
END, DocumentCulture ) AS [CMS_C],
ROW_NUMBER() OVER ( ORDER BY NodeAliasPath ) AS [CMS_ORN]
FROM View_CMS_Tree_Joined AS V WITH ( NOLOCK, NOEXPAND )
LEFT OUTER JOIN COM_SKU AS S WITH ( NOLOCK ) ON V.NodeSKUID = S.SKUID
WHERE [NodeSiteID] = @NodeSiteID
AND [NodeAliasPath] = @NodeAliasPath
) AS SubData
WHERE [CMS_C] = @CMS_C
ORDER BY CMS_ORN;
Thank You