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
Step 2 – Select the intended web application from list, then from ribbon select Resource Throttling under General Settings
Step 3 – Resource throttling dialogue has several options
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
Steps to configure the List Throttling
Step1 – From SharePoint Central Administration, select manage web applications
Step 2 – Select the intended web application from list, then from ribbon select Resource Throttling under General Settings
Step 3 – Resource throttling dialogue has several options
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)Daily Time window for large queries – This is preferred solution for dealing with large queries.
{
SPQuery query = new SPQuery();
query.Query = theCaml;
query.QueryThrottleMode = SPQueryThrottleOption.Override;
SPListItemCollection results=list.GetItems(query);
}
No comments:
Post a Comment