I’m concerned about the perfomance of an application that i’m about to deploy.
I’m the application, i have got to delete certain documents using an action button. The issue is that i have to delete that documents that contain a certain ID and that are interrelated (similar to a DELETE cascade in sql). Right now i’m looping through db.alldocuments checking if each document matches the condition. I fear this algorithm will get slower as the db grows, so i’m thinking of alternatives:
Use a db.FTSearch and loop through the documentcollection
Use getFirstDocument(key) from notesView
Create a categorized view(by ID) and loop through the docs.
Agents?..
I do some doc updates in the same way i delete, so the solution can apply to diferent areas of my db.
Can you tell me which one is better approach? Can you provide better solutions?
I would use “view.GetDocumentByKey(key, True)” or “view.GetAllEntriesByKey(key)”. “view.CreateViewNavFromCategory(key)” method can also be interesting.
That’s great! The problem lies in that I need a subset of document instead of a single document that match a criteria.
I did some experiments(with not so many docs, cause my db in not that large), by the way, and here are the results in case someone’s interested:
Searching across 5000 docs (where about 100 match the criteria and require looping), on an indexed database(server and client on the same machine, PIII 600Mhz 384Mb ram, winXP), using:
db.alldocuments + conditional IF to check condition:
22 seconds aprox
view.getAlldocumentsByKey(criteria)
1 second aprox
db.FTSearch(criteria)
1 second aprox
With this amount of docs, i can’t see the difference between the 2 last methods. I think I’ll follow your advice and use view.getAllDocumentsByKey because views are always indexed, and I don’t always get the expected results from FTSearch.