In the project I'm working for a client, we create a WebPart on the home page that display the recent documents added to the site. We have a single template for our SPWeb and can rely on some robust and powerful query tools such as SPSiteDataQuery.
To display it, we rely on /_layouts/copyutil.aspx. On my VPC, this works great but when deployed in production; the clients complain it's very slow (we have about 200,000 documents). So I pop up Reflector and have a look into the Microsoft.SharePoint.ApplicationPages.CopyUtil class and found this:

Is it a joke? A big query retrieving ALL the items in the list… * strangling *
The query should have be:
|
SPList list = web.Lists[this.ListId];
SPQuery query = new SPQuery();
query.Query = "<Where><Eq><FieldRef Name=\"ID\"></FieldRef><Value Type=\"Integer\">" + this.ItemId.ToString(CultureInfo.InvariantCulture) + "</Value></Eq></Where>";
query.ViewAttributes = "Scope=\"RecursiveAll\"";
SPListItemCollection items = list.GetItems(query);
if (items.Count == 0)
throw new ArgumentException();
return items[0];
|
Or in another way we can just have list.GetItemById(this.ItemId) as that method performs the same.
So if you use some list containing huge volume of data, you should consider writing your own version of CopyUtil…