Tuesday, January 31, 2012

My Understanding of SharePoint List View Threshold

In SharePoint 2010, administrators can configure resource threshold on list view for each web application. The default value is set to 5000, which means a list view can't return more than 5000 items.

Many online posts, including this excellent technet article, have told the story of resource throttling for large list in depth. Here I just want to share my reader's digest version.

Why 5000? Why not 8000? Well, it turns out this threshold has not much to do with SharePoint itself, rather it is actually coming from SQL Server.

In SQL Server, a list item essentially is a row in AllDocs table on a content database. SQL Server uses row locks to prevent multiple users from making conflicting modifications to table rows: when a row is locked by a user, no other users can modify it until the first user finishes modification and relinquishes the lock.

Row locks will occupy resources. If too many row locks (by default > 5000) are created, system might not sustain the overhead, and SQL Server will escalate the row locks to a single table or partition lock. Locking an AllDocs table means no user can modify content within a content database. Oops, get ready for the flooding of remedy tickets..:)

A list view is generated by a SQL Query against AllDocs table. The List View Threshold is introduced to prevent lock escalation, and it has to be <= 5000 to avoid locking AllDocs tables.

What if I need to render more than 5000 items in a list view? There are ways to do it:
          Folders are automatically indexed on creation.
          This is known as the "Happy Hours", when list view can return as many as items as users
          want, and it can be configured at the same place as list view threshold. In fact, we should
          create in index columns within "Happy Hours" since the creation process itself has to travel
          through all list items which is prevented by list view threshold.

Above is my quick review of the list view threshold. Hopefully it's helpful..:)

No comments:

Post a Comment