1

I work for a company that creates software that interfaces with Sharepoint using Web Services. We have run into an issue at a few clients where we are hitting the threshold limit on document libraries that contain records greater then 5000, even though our query is only returning a few records. It was my understanding that you would only hit the limit if your query or view returned 5000 or more records.

Here's an example of a request using the lists.asmx web service.

var libID = "{97769110-C075-4BB8-93F3-8FD97A1C5AEB}";
var viewName = null;
var xnodeQuery = "<Query><Where><Eq><FieldRef Name=\"BATCH_NO\" /><Value Type=\"Text\">123456ABC12345</Value></Eq></Where><OrderBy><FieldRef Name=\"Created\" Ascending=\"False\" /></OrderBy></Query>";
var xnodeViewFields = "<ViewFields Properties=\"True\" />";
var xnodeQueryOptions = "<QueryOptions><IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns><DateInUtc>TRUE</DateInUtc><ViewAttributes Scope=\"Recursive\" /></QueryOptions>"
var xListItems = listService.GetListItems(libID, viewName, xnodeQuery, xnodeViewFields, "", xnodeQueryOptions, "");
  • Can you post the code which hits the threshold limit? – Akhoy Oct 20 '15 at 17:20
  • 1
    What are the indexed columns ? Your filter columns need to be indexed, even if it returns less 5000 items. – JayHell Oct 20 '15 at 18:11
  • Ok well i wasn't aware i needed to create an index even if i'm returning less then 5000 records!!! – adha409 Oct 20 '15 at 18:14
  • You don't have to if you are not going to go over 5k. Indexing is good regardless, anything that can help performance. – Eric Alexander Oct 20 '15 at 18:35
  • Well ok now i'm confused ... Will you hit the threshold limit on a list that contains no index's and has over 5000 records if you are returning less then 5000 records? – adha409 Oct 20 '15 at 18:40
2

Apart from improving performance, indexing may help in averting the list throttling issues if applied properly.

Suppose, you create a view and apply a filter on non indexed column and the view returns 4000 items and total number of items in a list is 7000. Normal users with non admin access will get throttling exception. This is because the view will try to scan all items (7000) in the list and then apply the filter. However, if the field is indexed, it will only scan 4000 items and users won't see throttling exception.

See this for more information: I have list contains 7000 item, and I need to show latest 10 items on the home page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.