覆盖索引未在XML查询中使用

时间:2015-11-28 00:00:34

标签: sql-server

正在运行<p:outputLabel value="#{bundle.CreateReportsLabel_examrequisitions}" for="examrequisitions" /> <p:selectOneMenu id="examrequisitions" value="#{reportsController.selected.examrequisitions}" required="true" requiredMessage="#{bundle.CreateReportsRequiredMessage_examrequisitions}"> <f:selectItems value="# examrequisitionsController.itemsAvailableSelectOne}" var="examrequisitionsItem" itemValue="#{examrequisitionsItem}"/> </p:selectOneMenu> <p:outputLabel value="#{bundle.CreateReportsLabel_status}" for="status" /> <p:selectOneRadio id="status" value="#{reportsController.selected.status}"> <f:selectItems value="#{reportsController.status}" var="status" itemLabel="#{status}" itemValue="#{status}" /> </p:selectOneRadio> <p:outputLabel value="#{bundle.CreateReportsLabel_outcome}" for="outcome" /> <p:inputTextarea id="outcome" value="#{reportsController.selected.outcome}" title="#{bundle.CreateReportsTitle_outcome}" rows="7" maxlength="100" /> 。我有一个存储过程,我使用多个选择生成SQL Server 2014。下面是一个简化的例子。

XML

查看I / O,我发现SELECT (SELECT ... FROM X WHERE ID = @ID FOR XML PATH('x'), TYPE), (SELECT ... FROM Y WHERE ID = @ID FOR XML PATH('y'), TYPE), (SELECT ... FROM Z WHERE ID = @ID FOR XML PATH('z'), TYPE), (SELECT IndexedColumn1, IndexedColumn2 FROM W WHERE ID = @ID FOR XML PATH('w'), TYPE), FOR XML PATH(''), ROOT(root') IndexedColumn1没有显示任何IndexedColumn2。但是,当我在列表中添加几个简单选项时,我突然看到这些索引列的大量I / O.为什么呢?!

当查询变大时,似乎不考虑我的非聚集索引,即使此查询独立于查询的其余部分。我应该忽略这些增加的logical reads还是我确实做错了什么?

0 个答案:

没有答案