We have a SharePoint list containing 50.000 items, and want to fetch some data from it without disabling SP2010's default throttling.
From the MSDN artical on handling large lists, we figured the key ingredient would be using a small RowLimit on the SPQuery, and using ListItemCollectionPosition for batching.
However, with our code (something) like this, the throttling exceptions are still triggered:
SPQuery query = new SPQuery();
query.Query = "<Where><Contains><FieldRef Name=\"MatterName\" /><Value Type=\"Text\">7476922</Value></Contains></Where>";
query.ViewFields = "<FieldRef Name=\"MatterName\"/>";
query.RowLimit = 10;
int index = 0;
do
{
SPListItemCollection batch = mattersList.GetItems( query );
query.ListItemCollectionPosition = batch.ListItemCollectionPosition;
}
while ( query.ListItemCollectionPosition != null );
According to the MVP experts at SharePoint Connections 2010, this is by design, as the implicit sort on the resultset would still trigger the 5000 item throttling threshold.
Which is nice and all, but then how do we fetch from this list? Would using a ContentIterator be a better option? If so, what is the magic the content iterator would pull off to make this happen?
You can use:
query.QueryThrottleMode = SPQueryThrottleOption.Override;
by executing the query as a super user.
http://adicodes.com/sharepoint-2010-list-throtelling/
As an admin, not a developer, I don't have a code solution for you - but do have 2 no-code "solutions" for you to consider.
Both these settings are adjusted at the Web Application level
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With