SharePoint 5000 Resource Limit

In this article, Microsoft explains why there is a limit of 5,000 units. But when can I access more than 5,000 items?

Example: I have a list of 50,000 items and I am executing a caml request with a row limit of 50. Does the sharepoint block the database or only 50 rows? How does sharepoint know whether to lock only certain rows or the entire database? Or does it depend on the stone itself?

Is the lock associated with the entire farm or only with the current list, because sharepoint does not have its own table for each list?

+4
source share
5 answers
  • Reading all items in a large list

SharePoint 2010, SPQuery , . " , , ". , Content Iterator.

ContentIterator , http://msdn.microsoft.com/en-us/library/ee560760%28v=office.14%29.aspx

ContentIterator, Microsoft.Office.Server.dll 14/ISAPI/ Microsoft.Office.Server.Utilities.

:   , .   , List View Threshold, . SPQuery .   . : SPQuery.

//Run as console application
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.Office.Server.Utilities;

namespace ContentIteratorListItemCollBatch
{
    class Sample
    {
        static int NumberOfBatch = 0, NumberOfItemsRead = 0, NumberOfException = 0;

    static void Main(string[] args)
    {
        using (SPSite site = new SPSite("your site url"))
        {
            using (SPWeb web = site.OpenWeb())
            {
                SPList list = web.GetList("Lists/LargeList/AllItems.aspx"); //your list url
                ContentIterator ci = new ContentIterator("Reading All Items");

                SPQuery qry = new SPQuery();
                qry.QueryThrottleMode = SPQueryThrottleOption.Strict; //Ensuring that all users come under List View Threshold. (Including farm admins / box administrators).

                qry.RowLimit = 2000; //Number of Items read in a batch. But it should be less than List View Threshold.

                qry.Query = qry.Query + ContentIterator.ItemEnumerationOrderByID; //Not Required, Include for faster output.  
                //Don't use ContentIterator.ItemEnumerationOrderByNVPField, it gets into infinite loop.

                ci.ProcessListItems(list, qry, ProcessItemColl, ProcessErrorColl);
                Console.WriteLine("\nBatch count: " + NumberOfBatch + "\n\nTotal number of items read: " + NumberOfItemsRead);
                Console.ReadLine();
            }
        }
    }

    static public bool ProcessErrorColl(SPListItemCollection itemColl, Exception e)
    {
        // process the error
        NumberOfException++;
        return true;
    }
    static public void ProcessItemColl(SPListItemCollection itemColl)
    {
        //Work on the ListItem Collection object with your own condition
        //foreach (SPListItem item in itemColl)
        //{

        //}
        Console.WriteLine("Number of Items Read: " + itemColl.Count);
        NumberOfBatch++;
        NumberOfItemsRead += itemColl.Count;
    }
}

}

25 000 . , 25 000 2000 .

Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 1000

Batch count: 13

Total number of items read: 25000

. . ContentIterator.ItemEnumerationOrderByNVPField. Title . , .

//

System; System.Collections.Generic; System.Linq; System.Text; Microsoft.SharePoint; Microsoft.Office.Server.Utilities;

namespace ContentIteratorListItemCollBatch
{
    class Sample
    {
    static int NumberOfBatch = 0, NumberOfItemsRead = 0, NumberOfException = 0;

    static void Main(string[] args)
    {
        using (SPSite site = new SPSite("your site url"))
        {
            using (SPWeb web = site.OpenWeb())
            {
                SPList list = web.GetList("Lists/LargeList/AllItems.aspx"); //your list url
                ContentIterator ci = new ContentIterator("Reading All Items");

                SPQuery qry = new SPQuery();
                qry.QueryThrottleMode = SPQueryThrottleOption.Strict; //Ensuring that all users come under List View Threshold. (Including farm admins / box administrators).

                qry.RowLimit = 2000; //Number of Items read in a batch. But it should be less than List View Threshold.

                qry.Query = @"<Where><Contains><FieldRef Name='Title' /><Value Type='Text'>9</Value></Contains></Where>";

                qry.Query = qry.Query + ContentIterator.ItemEnumerationOrderByNVPField;
                //Have to include this line.

                ci.ProcessListItems(list, qry, ProcessItemColl, ProcessErrorColl);
                Console.WriteLine("\nBatch count: " + NumberOfBatch + "\n\nTotal number of items read: " + NumberOfItemsRead);
                Console.ReadLine();
            }
        }
    }

    static public bool ProcessErrorColl(SPListItemCollection itemColl, Exception e)
    {
        // process the error
        NumberOfException++;
        return true;
    }
    static public void ProcessItemColl(SPListItemCollection itemColl)
    {
        //Work on the ListItem Collection object with your own condition
        //foreach (SPListItem item in itemColl)
        //{

        //}
        Console.WriteLine("Number of Items Read: " + itemColl.Count);
        NumberOfBatch++;
        NumberOfItemsRead += itemColl.Count;
    }
}

}

SPQuery, , , . ContentIterator .

Output
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 2000
Number of Items Read: 233

Batch count: 5

Total number of items read: 8233
+1

-, " " - . (, SPSite), . AllUserData. , , , - . , , .

- . , 5000 , . SharePoint . , . , . . " " - , . , , " " . , 30 . , - , 5000.

0

, .

- . 50 . , , .

SPSiteDataQuery.

50 .

5000, , , . , . , , . SharePoint , , "SharePoint", SharePoint .

0

20k, 200k (MS 5k). 4 , , 20 k , , 30 . . 5k , ? , 3 ?

0

30 , . , orderby 20 k , 30. , .

0

Source: https://habr.com/ru/post/1613313/


All Articles