Lotus Notes / Domino Sonstiges > Tipps und Tricks

Don't use GetNthDocument

(1/1)

Axel:
Hi,

das hab ich heute zufällig gefunden.


--- Zitat ---The GetNthDocument method is widely publicized as the way to loop through a collection.

It works - within a loop, you will progress through a collection and successfully process all documents.

However - on a medium to huge collection, processing speed will deteriorate dramatically.

Why? - because position in the collection is re-established on every GetNthDocument by counting upwards from the first document each and every time. Thus, performance deteriorates as the position increases.

What else then? - Use the GetFirstDocument and GetNextDocument methods in all your collection and see your code speed along!

As a guide, one relatively simple agent running against 110,000 documents took 48+ hours using GetNthDocument and less than 1.5 hours when GetFirstDocument and GetNextDocument was used.
--- Ende Zitat ---


Axel

Till_21:
Das mag sein, aber:
1) willst du z.b. best. doks loeschen, musst du getnthdocument() verwenden,
2) wer nutzt schon für DB von 110000! Dok-Größe Notes ?

Axel:
Hi,

zu 1.

Zum Löschen kannst du auch GetFirstDocument, GetLastDocument, GetNextDocument und GetPreviousDocument verwenden. Das ist sogar in bestimmten Fällen sinnvoller.

Wenn du markierte Dokumente löschen willst geb' ich dir recht.

zu 2.

Warum nicht ?

Axel

Till_21:
zu 1) hol ich mir mit getfirstdocument ds erste document und loesch dieses mit der methode remove, kann ich nicht mittels set doc = collection.getnextdocument(doc) auf das nächste document verweisen, da die referenz vom objekt doc nicht mehr gegeben ist. merk ich mir das dokument mittels set temp = doc und loesch es nach dem aufruf getnextdocument, hab ich bei 100000 dokumenten auch erheblich längere zeiten.

Gruss / Till

Axel:
Hi Till,

ich glaube das bezieht sich nicht unbedingt auf das Löschen, sondern auf Aktualisierungen von Dokumenten.

Axel

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln