About Duffbert...

Duffbert's Random Musings is a blog where I talk about whatever happens to be running through my head at any given moment... I'm Thomas Duff, and you can find out more about me here...

Email Me!

Search This Site!

Custom Search

I'm published!

Co-author of the book IBM Lotus Sametime 8 Essentials: A User's Guide

Purchase on Amazon

Co-author of the book IBM Sametime 8.5.2 Administration Guide

Purchase on Amazon


Visitor Count...

View My Stats

« Book Review - A Wanted Man by Lee Child | Main| Book Review - The Willpower Instinct: How Self-Control Works, Why It Matters, and What You Can Do To Get More of It by Kelly McGonigal, Ph.D. »

Question from a reader (XPages-related)... How does Notes get a document by NoteID?

Category IBM XPages
I received a question in my email the other day, and I wanted to open it up to the XPages community.  I think that the answer from a Notes client perspective might not be the correct answer given the XPages angle.  Feel free to leave comment(s)...

The question is: How does Notes get a document by NoteID?

It seems to me that it takes the NoteID and then compares it to each value in an internal list (index?) until it finds the document. This approach works fine if the database is small. However....I have a client that runs a database containing one million documents. Even at this extreme the user must only wait a second or two for the document to be found and opened, So it is still within acceptable limits. The fun really starts when you have an XPages repeat control that displays data from sixty documents. This XPage can take TWO MINUTES to open! Not so acceptable

I'm sure you know that the repeat control gets documents by NoteID to display. So the Domino server is receiving a list of sixty NoteIDs to find in the database. Now if the NoteIDs were represented in, for example, a B-Tree data structure then it would take only six matches or so to find each document. Instead it seems very much like the server is trying to find each one in a very long list.

I have gotten around the problem by moving the XPages application (including the documents accessed by the repeat control) to a smaller database. This is a bit kludgy but responds very fast to the user. But I'd still like to get some closure with this issue. I'd like to know what really happens in the black-box-that-is-Domino when you ask it to get a doc by ID. So far the IBM people that I've hit with this question have run away and hid. Not very helpful so all I can say now is......

help me Obi-Wan, you're my only hope



Gravatar Image1 - Another option for answers that was tweeted in relation to this was to try the Stack Overflow site.

Gravatar Image2 - Doesn't say if reader/author fields are involved,
Sounds like there is no index on this database.
Stephan Wissel has some comments on this:
{ Link }

Gravatar Image3 - Emoticon Emoticon Emoticon Emoticon Emoticon Emoticon Emoticon Emoticon Emoticon

Gravatar Image4 - I would highly suggest the question be reposted to stack overflow, with sample code and a redirection of the question away from asking about how documents are retrieved via note id, etc. Performance/scalability issues like this are not due to core api level issues as the question implies, but are oft due to misunderstandings in the how the xpages runtime fundamentally works, and the high use of several performance-sucking design decisions, which are usually exacerbated in repeat controls.

Gravatar Image5 - if the datasource of our repeat control is a view, use the viewEntry to get data instead of NotesDocument

Gravatar Image6 - Hi, I got pushed on to other projects and haven't been back here in a while. Anyway here are a few more details:
There are no reader/authors fields.
The database is indexed.
The way that the noteids are provided to the repeat control is not relevant. This can be put in as a static list so it *cant* take any time. It's when the system heads off to get the document by noteid that the time starts ticking away. It's easy to try this for yourself. Create an empty test db. Create a form called "X" and a view and create 60 documents. Create XPage with a repeat control that accesses data from all 60 documents. See that it opens instantly. Now create a new form called "Y". Then run something like this:
dim doc as notesdocument
dim i as long
for i = 1 to 999999
set doc = db.CreateDocument
doc.Form = "Y"
doc.DummyNumber = i
doc.Title = "dummy doc"
call doc.Save(true, false, true)

Now watch paint dry as your XPage opens Emoticon

Post A Comment


Want to support this blog or just say thanks?

When you shop Amazon, start your shopping experience here.

When you do that, all your purchases during that session earn me an affiliate commission via the Amazon Affiliate program. You don't have to buy the book I linked you to (although I wouldn't complain!). Simply use that as your starting point.


Thomas "Duffbert" Duff

Ads of Relevance...

Monthly Archives