Querying a large list

We have created an application on SharePoint that stores data in a list. There are 500 people user this application and they are generating 70 items each year. Multiply these values and you can see that the list is growing fast. The administrators of the application need to query that list often. We created a custom webpart to do this. A few weeks ago we encountered some performance issues with that list. We hit the throttle limit of course. Our first reaction was to use elevated permissions in the code but we still had the same performance issues (timeouts).

In our code we used

Dim list As SPList = SPContext.Current.Web.Lists(listname)

to access the listitems. Although we run the code with elevated permissions we still connected to the list with the current user’s context. That was wrong. We had to create a new instance of SPSite (and dispose it of course!). That solved our performance issue, the code was not 250% faster and our users were happy.

Using adminconnection As New SPSite(SPContext.Current.Web.Url)

Do you want to know more about working with large lists? You can find some articles here: