List Throttling is a new feature in SharePoint 2010, it allows us to set the limit of how many rows of data can be retrieved from a list at a time. By default the list throttles to 5000 items. Let’s consider we have a list with 50000 entries and a user comes and creates a view with all the entries, then the SharePoint will return either error or the first set of results up to the number put in the list throttle.
The throttle can be set on the lookups in a list, and we can limit the lookup columns. If we have too many lookups the performance will suffer. As we limit maximum throttle for the user, we can override the same on the Object Model if we have the sufficient privilege.
using (SPSite site = new SPSite("http://mysite"))
{
using (SPWeb web = site.RootWeb)
{
try
{
SPList list = web.Lists["Shared Documents"];
SPQuery qry = new SPQuery();
qry.QueryThrottleMode = SPQueryThrottleOption.Override;
SPListItemCollection coll = list.GetItems(qry);
}
catch(SPQueryThrottledException)
{
// Throttle exception
}
}
}
No comments:
Post a Comment