I have a database containing about 20,000 documents. In my application I need to generate a consolidated report based on the different criteria (like documents older then six month with flag value "1", similarly about 21 counters I calculate). In the process of computing different counters, my agent goes to each document, checks to which category document belongs, and increases the appropriate counter. The problem is that it is taking 3 to 5 minutes on the Web to process and display the report. Can I use the Notes index some way, or is there any other method to speed up the report generation process?
Without out knowing more about the code and the particulars, It's difficult to be too specific, but I have some questions/suggestions in the order that I believe might provided the best performance increase: 1) Create separate views that only select the documents that meet each of your counter criteria. For example, documents older than six month with flag value "1". The view will only contain the documents you are interested in. You could then .AllEntries property of the NotesView class to create a NotesViewEntryCollection. Then you could use the .Count property of the NotesViewEntryCollection class, which will return the number of entries (NotesViewEntry) in the view. If there are no categories or totals in the view, the number of entries will be the number of documents, giving you your count. Then simply process each view in a loop and you have all your counters.
2) If it's not practical, possible to create the views, use either the FTSearch or Search method of a views that selects all the documents you need to processes. This will return a NotesDocumentCollection of all documents that match the criteria you supply. The use the Count property of the NotesDocumentCollection class to get the number of documents in your collection. Perform n searches (where n is the number of counter criteria).
One of these techniques should be significantly faster than the current method. Keep in mind that if you must loop through the documents to accomplish your objective you can use the ColumnValues property of the NotesDocument object to read your values from the view rather than the underlying document, which will yield a marginal performance boost. Additionally, be sure to use the GetFirstDocument and GetNextDocument methods of NotesView to loop through the documents rather than the GetNthDocument method, which is MUCH slower.
Dig Deeper on Lotus Notes Domino Administration Tools
Related Q&A from Dave Hatter
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.