SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm implementing a full text search on list contents.

Is it more efficient to fire a SPSiteDataQuery on every request with a dynamically built CAML-Query, to filter the items?

Or is it better to fetch the data once, store it in e.g. HttpRuntime.Cache and filter the data somehow in code (maybe via DataTable.Select or something...didn't try this).

What do you think?

share|improve this question
How much data are we talking? – Mike Oryszak Jan 10 '12 at 20:05
about 200 - 300 items stored in 2 lists – HutzelGutzel Jan 10 '12 at 22:43
hmm, 200-300 items in 2 lists. Do they have (multi-)lookup fields? – Bas Lijten Jan 11 '12 at 8:40
No. The items are in the standard pages list (PublishingPages) and a custom document library (Documents with some additional metadata). Data of the items from both lists will be displayed in one result list. – HutzelGutzel Jan 11 '12 at 8:48

I would go with the first option, as the SPSiteDataQuery already makes use of caching, if you use it correctly. It's fast as hell ;)

check my blogpost about it:

Steve peschka wrote a document on it in the past:


share|improve this answer
In your blog you're talking about CrossListQueryCache. When the query changes (which does, because the CAML is created dynamically to filter the items), does it clear the cache and fetch new results? The document from Steve Peschka doesn't help because it is about SPQuery and PortalSiteMapProvider. – HutzelGutzel Jan 11 '12 at 8:13
no, the items are cached, not the query with its items. – Bas Lijten Jan 22 '12 at 19:07
so then CrossListQueryCache isn't capable for a full text search. If the query changes there MUST be only the new requested items. – HutzelGutzel Jan 25 '12 at 16:14
Is using search an option, then?! – Bas Lijten Jan 25 '12 at 17:12
No, unfortunately that's not an option. So I'll stick with an SPSiteDataQuery on every request. – HutzelGutzel Jan 25 '12 at 19:33

If you want SPSiteDataQuery functionality along with caching, better to use CrossListQueryCache and CrossListQueryInfo classes.

Check here for excellent details :

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.