Monday 11 August 2014

Content Query Web Part stopped working

One Monday we have experienced a strange issue with our Content Query Web Part. It was configured to list the files checked out to a logged in user across the whole site collection.
[See this guide on how to accomplish this]
This solution worked for ages for us, but one day- it stopped! What I mean by "it stopped" is- the admin user could still see their results (files checked out to admin) in the web part.
An ordinary user (reader/editor/contributor) had nothing listed in the web part (no results, no error messages, nothing!, even when they had files checked out to them).

I have seen the following threads on the support forum while doing the research:

Content Query WP not showing columns for some users
Some sharepoint actions stopped working
CQWP stops showing results, until it is edited
CQWP - Not returning results after extensive research

but none of them were really applicable.

I have stumbled upon this blog post and learned about LTV's (List Value Threshold).
It is configured under CA/Application Management/Manage Web application.
You click your relevant web application, go to General Settings and click Resource Throttling.


As you can see, the default limit of items that the single database operation can involve at one time is 5000. Since we are querying against the whole site collection, on that Monday we must have exceeded that limit so the web part no longer worked for ordinary users.
As you can see from the screenshot above, the limit for admin users is higher. That explains why the web part worked for admin users.

A few options:
1. Increase the limit (not recommended due to SQL locks and loss of performance) so your web part can query and pick up items.

2. Archive old files so we will remain below the default limit of items.

3. Change the solution, utilise Search web part or something else.