The content query web part is a powerful tool. As a Support Escalation Engineer I get to see some very creative ways in which customers use this tool. In this blog post I will be discussing how you can use ViewFieldsOverride to reduce not only the duration of these queries, but also the amount of data returned.
When you perform a query using the out of the box Content Query Web Part (CQWP) SharePoint will pull from the database every column in your list or page library even if you only need to display a few columns. This causes the query to take longer and to move a lot more data from the database server back to the WFE server.
When you use the ViewFieldsOverride you can specify the columns you want to display and SharePoint won’t pull back all of the extra columns.
As you can see from the above results, the duration, Reads (I/O), CPU, and the amount of data returned is decreased with the ViewFieldsOverride enabled.
Here is an example of the change made to the exported CQWP.
<property name="ViewFieldsOverride" type="string">
<![CDATA[<FieldRef Name="Title" Nullable="True" Type="Text"/>]]>
</property>