Monday, March 11, 2013

List Throttling in SharePoint 2010

Heavy database operations on SharePoint server may sometimes affects the user experience; SharePoint 2010 introduced a concept of List Throttling which prevents your server being going down. List Throttling allows an administrator to specify the maximum number of items that can be retrieved in a single request. For example, if user creates a view with page size 5000 but if administrator limits the list view threshold of 2000 items, no rows will be returned to user.


Steps to configure the List Throttling
Step1 – From SharePoint  Central Administration, select manage web applications


image
Step 2 – Select the intended web application from list, then from ribbon select Resource Throttling under General Settings
image
Step 3 – Resource throttling dialogue has several options
image
List View Threshold – This property value specifies the number of items that can be returned by a single query
Object Model Override - If you want to execute larger queries, using these option developers can override List View Threshold on a per query basis by writing the below code
private void DoQuery(SPList list, string theCaml)
{
SPQuery query = new SPQuery();
query.Query = theCaml;
query.QueryThrottleMode = SPQueryThrottleOption.Override;
SPListItemCollection results=list.GetItems(query);
}
Daily Time window for large queries – This is preferred solution for dealing with large queries.




No comments:

Post a Comment