Best Practices For Accessing And Retrieving Data in SharePoint 2010 – Part 2 – Content Query Web Part
There are several beneficial reasons to use the Content Query WebPart with SharePoint 2010. The Content Query WebPart retrieves the content from lists. This can be used for pages, documents, and lists. The Content Query WebParts are cached by default and which offers better overall performance. It also uses fewer SQL Server resources. The default cache setting is for thirty minutes so you will have data that is close to being current. However, this also means that you will use more SQL Server resources than the search queries do. It is excellent for navigating, has simple configuration for the column displays, multiple content query WebParts can be used on the same page, it has fast load time when you compare it to list views and search, and SQL use is reduced due to the default for cache. While there are a limited number of properties are displayed, links go to the items directly, and list actions can’t be performed it is still exceptionally useful.
There are several things that need to be taken into consideration regarding the Content Query WebPart. Content Query WebParts can be used to return items that user’s access often and can be used for a large list. You should use filters though for items so that the query won’t exceed the list view threshold. With the Content Query WebPart only columns with indexes for filtering should be used and shouldn’t be used when you need to query multiple lists if you will exceed the view threshold for auditors or administration.
Since Content Query WebParts offer the least amount of HTML they are faster for the pages to show up. You can also use multiple Content Query WebParts to configure the pages. Cached content query WebParts provides quick data access as list size gets larger. The non cached Content Query WebParts have latency on part with a similar list view.
Content query WebParts can be used as part of navigation to help provide content on pages. It can also be used for high read scenarios where most of the users don’t need to perform list actions.
The Content Query WebPart can be used as a means of accessing the content without entering a list view. A user is able to have a small amount of content that they use often or that they have a desire to track. The document center site templates make this possible based on information logged by a given user. The defaults can also be set to track highest rated documents and more recent documents accessed. The use of these measures allows for a user to quickly access such documents again and again.
The use of Content Query WebPart when you have a large lists allows you to get accurate results. You want to make sure you follow the guidelines though so you don’t get blocked due to the list view threshold being exceeded. The items have to be filtered so that they are less than what will be used by the indexed column. It isn’t recommended that you use cross list queries for a large list.