List view threshold error – Many times when we deal with the big lists in SharePoint, we get the error: “This view cannot be displayed because it exceeds the list view threshold (5000 items) enforced by the administrator”. In this article, we will learn about the root cause of this error and its fix.
Introduction – List view threshold error
The threshold concept was introduced in SharePoint 2010 considering the performance issue while loading the big list to improve the query performance. There is a wrong perception about the SharePoint list view threshold 5000 error – many users think that the SharePoint list/library just can store 5000 items but that is not true, in fact, the SharePoint list can store 30 million items. Then why are we getting this error? Before we analyze this error I recommend you to read my previous articles “How does the database column indexing work in SharePoint?” and “How to create indexed column in SharePoint?”
Why do we get a 5000 threshold error (List view threshold error)?
This error actually comes from SQL, not from SharePoint. As I have explained in my previous article “How does the database column indexing work in SharePoint?” there we have seen that SharePoint stores all of its list data and list columns in a single SQL table, i.e. “AllUserData” table.
Now we need to learn how the query gets processed (List view threshold error)
When we browse a list or library SharePoint sends a query to SQL and SQL process that query and send the result to SharePoint, then finally we can see the result i.e. nothing but list or library items in the browser. Let’s take an example of the “All Items” view(assumed that no filters were applied to it) – when we click on this view SharePoint will build a query and pass this on to SQL, then SQL process that query and send the result to SharePoint. Now if the results returned by the query are more than 5000 then the user gets the above-mentioned list view threshold error.
Why does this limitation set as 5000 in SQL (List view threshold error)?
Due to performance reasons, if the SQL server performs the query on a single table (here it is: “AllUserData” table) which would result in the output of more than 5000 items, in this case, the SQL server will lock the entire table while the query execution is on – this is the default behavior of SQL by the designed.
So when the “AllUserData” table is locked – what will it happen?
So far as we have learned that SharePoint stores all list/library data in a single table i.e “AllUserData” – a single query that returns more than 5,000 items will lock all of the list and library data for that entire content database.
In this scenario – the business users who were accessing the content in SharePoint from the same content site collection (content database) while the “AllUserData” table is locked, will have to wait a long time for their results to be displayed.
By now we have learned about the root cause of threshold error and we need to focus on how to move on with this situation as the business has to run.
How to overcome the 5000 items list view threshold issue?
We can increase the list items limit from 5000 to 50000(fifty thousand) in SharePoint on-premise, in fact, we can disable the list view threshold limit which is not all recommended but in SharePoint online we don’t have control over it, so we need to move on with the whatever limitation is set i.e. 5000.
Here based on my experience, I will list some tips and tricks to avoid this issue which will work both for SharePoint Online and on-premise.
- Planning – before creating the list or library, analyze the data, and plan accordingly. Try to split the data into multiple lists or libraries.
- Create multiple views and add the “AND” condition in the list filter criteria, never add the “OR” condition, the “OR” condition will try to get the all data.
- Create an index column – we can only have 20 indexed columns in a given list. so we need to plan this thoughtfully!
- We can not create an indexed column if the list is already hitting the list view threshold limit.
- Maintain the Archive list – here we need to review the list items periodically and need to check whether some items can be deleted or archived to another list – where we can write some automation jobs which will be moving the items periodically to another archive list automatically.
- In the list filter criteria, we need to filter the list items in such a way that at any given point of time list view will return less than 5000 items using the filter on created column technique(please see the explanation below).
Create filter [Today]- “number of days” (List view threshold error)
Here one of the techniques is – to create a filter on the “Created” column and use the [Today]- “number of days” with less than or equal to the condition, something like below:
The logic behind the filter on the created column is – this will try to get the items that will return less than 5000 items. If this condition also returns more than 5000 items, we need to split this up created column conditions with multiple “AND” conditions with the combination of some other column to ensure the filter returns less than 5000 items as the below example – through the implementation of this technique is time-consuming.
Practically – let’s see when what happens when a list exceeds 5000 items (List view threshold error).
I have created a list named “Test List” which adds more than 5000 items using the below PowerShell script to see what happens when it crosses the 5000 limits.
Execute the above script like below:
Now if we go to the list setting page (example as “Test List”), we can see the message below which says this list exceeds the 5000 threshold limit.
Summary: List view threshold error (how to overcome the 5000 items list view threshold issue)
Thus, in this article we have learned the below concept with respect to the SharePoint list view threshold:
- What is the threshold issue in the SharePoint list?
- Why do we get a 5000 threshold error?
- Why does this limitation set as 5,000 in SQL?
- How to overcome the 5000 items list view threshold issue?
- Practically – saw what happens when a list exceeds 5000 items.
- How to fix the list view threshold enforced by the administrator error in SharePoint Online and On-Premise.
- How to fix that “this view cannot be displayed because it exceeds the list view threshold (5000 items) enforced by the administrator”
Having described the threshold limit issue and their possible workaround to fix this in SharePoint – it’s an impending open issue over a decade from Microsoft, which really Microsoft needs to fix or come up with some inbuilt alternate technique. This issue is one of the drawbacks of SharePoint which leads to many business user dissatisfactions with SharePoint. So Microsoft really needs to fix this issue in the long run!!!
See Also: SharePoint Online Tutorial
You may also like the below SharePoint Online tutorials:
- SharePoint: Show item modified in the past 14 days in list web part
- How to create indexed column in SharePoint on-premise and online – O365?
- SharePoint – O365 – How does the database column indexing work in SharePoint?
- Office 365: Getting started with SharePoint PnP PowerShell – installation
- In 2 steps convert a classic SharePoint page to modern using PnP
- Office 365: Retrieve hub sites and associated sites using PnP Powershell
- Create a modern team site using PnP PowerShell in SharePoint
- In 4 steps access SharePoint online data using postman tool
- SharePoint admin center: Learn SharePoint online administration in an hour – step by step
- SharePoint REST API: GET vs POST vs PUT vs DELETE vs PATCH
- Office 365: Understanding the hub site in SharePoint online
- The number of items in this list exceeds the list view threshold” when you view lists in Microsoft 365