Gunnar Peipman's ASP.NET blog

ASP.NET, C#, SharePoint, SQL Server and general software development topics.

Sponsors

News

Blog Directory
Blogging Fusion Blog Directory
Web Directory
Blog Directory
EatonWeb Blog Directory
GeekySpeaky: Submit Your Site!
Blog Directory
blogarama - the blog directory
Bloglisting.net - The internets fastest growing blog directory
Blogio.net blog directory
Free Blog Directory
blog search directory
Software Blogs
RSSMicro FeedRank Results
On our way to 1,000,000 rss feeds - millionrss.com
Listed in LS Blogs the Blog Directory and Blog Search Engine
blog directory
Link With Us - Web Directory
Web Blogs Directory Add Your Blog.com

Certificates

Links

Social

SharePoint: Save performance when getting list items

Another day, another solved mystery. Developers have interesting lifes as long as there are problems to solve. Another surprise from SharePoint - how to bog server down using only couple of lines of code? Of course, I have solution too that eliminates the issue.

Let's say you have large document library with many documents (let's say there is a little bit more than 90.000 documents). Some of them are versioned, some of them are new and so on. Now, let's say you have to manipulate documents in your code and you have to find document with specific ID. The document, if it exists, is given to you as SPListItem:


... 
SPListItem item = list[new Guid(itemGuidString)];
...

When you try something like this the code may run fast - as long as you have few documents you don't have any performance issues. But if you have about 90.000 documents than retrieveing one document as list item may take about 1:00 or 1:30 minutes with no problems. And good server you are using is not saving you this time.

What you have to do is to ask documents by items's unique ID from SPList.


...
SPListItem item = list.GetItemByUniqueId(new Guid(itemGuidString));
...

If you ask documents this way then documents are retrieved through CAML query and you save on performance a lot.

Posted: Apr 18 2008, 02:22 PM by DigiMortal | with 6 comment(s) |
Filed under:

Comments

Tobias Zimmergren said:

Good tip.

# April 18, 2008 12:06 PM

Àlex said:

+90.000 docs in a single document library!

It breaks all the recommendations about performance in a SharePoint lists, doesn't it?

If you put the files in folders (in the same doc. lib.) of 2.000 items have you the same issue?

# April 21, 2008 4:34 AM

DigiMortal said:

Suggestions about list sizes I have read from official papers was max 100K. All documents are in folders and these folders are not large. Let's say one folder has about 5-15 subfolders and 20-40 documents.

# April 21, 2008 5:21 AM

Links (4/20/2008) « Steve Pietrek - Everything SharePoint said:

Pingback from  Links (4/20/2008) « Steve Pietrek - Everything SharePoint

# April 21, 2008 11:36 AM

lease option said:

Now, I also have a spreadsheet that compares the net financial result between never refinancing, refinancing every 5 years and keeping a target of paying all loans off in 360 months from the time you bought, and refinancing every 5 years but making the

# May 1, 2008 3:04 PM

Martin said:

As SharePoint Server gains popularity and more and more server farm configurations are deployed for a large number of concurrent users, application performance can suffer if the database bottleneck is not properly addressed.

NCache can help remedy the situation by caching objects and sessions in memory in a highly synchronized manner across multiple servers in a web farm thereby reducing expensive database trips and rendering the SharePoint application highly scalable and lightening fast.

# August 20, 2008 2:07 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)