Tip #66: [SP2010] SPQuery can fail if you don't limit result set

Rate this item
(0 votes)

SPQuery object of SharePoint 2010 can fail or block results if we don't limit the result set.

This object is used to query list and other collection objects, and it performs well when we set the number of returned values. Quering large lists without limit will block the results of SPQuery or it can perform very slow.

Depending of the edition of SharePoint (Server or Foundation) limit the SPQuery using the following methods/parameters:

  • RowLimit
  •  ContentIterator.MaxItemsPerQuery (Server only, use Threshold limit for Foundation)
  •  OrderBy clauses

Source: http://msdn.microsoft.com/en-us/library/ee558807(office.14).aspx

 

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.