Posts Tagged ‘notesview’

29 Aug 2012

Notes Database Performance Tip: Optimize Document Table Map

Hi Everyone. In the past few days I’ve been asked to audit a few Notes Applications. Apart from the usual disabling of unread marks and removing views no longer used to increase performance, there is a very important setting on a Notes Database and can drastically reduce the indexing time of Notes Views.

It’s called “Optimize Document Table Map“.

Firstly, a quick scenario:

Let’s say you have a Notes Application that contains about 5 different Forms. For each form you have about 3 – 5 Notes Views. Also for each Form you have about 5000-10000 documents.

When it comes to indexing Views, if the property “Optimize Document Table Map” is not selected in the Notes Database Properties, the following happens:

When indexing a certain View,  Notes will search through all documents created from all 5 Forms in the Database to produce the result in the View. If you only have a few hundred documents in the database, then this is not an issue. However, 50 000 documents later this could lead to poor performance of your Views.


So, let’s say that you have “Optimize Document Table Map” selected in the Notes Database Properties, the following will happen:

When indexing a certain View, Notes will only search through all records in the Database that were created using the Form that’s specified in the View Selection Formula. This means that if you have 5 Forms in the Database, and 5 000 records for each Form, Notes will only search through 5 000 records for a specific Form to index the Notes View. Can you imagine the Response Time :)


So, where to enable this setting? If you right-click on your Notes Database and go to the “Database Properties”, click on the last tab. You will see towards the Top that you can check the option “Optimize Document Table Map


2 Important Notes when enabling this Setting:

1. I’ve had varied results with enabling this property and just expecting it to work. I highly recommend compacting the database after enabling this Setting just to be sure.

2. In order for this setting to Work, it’s very important that your View Selection Formula for your Notes View specifies the Form Name.

i.e. If your View Selection Formula only says Select FirstName = “John”, then you won’t see a performance boost on the view. However, if you say Select Form = “Person” & FirstName = “John”, this will work because you are referencing the Form Name inside the View, which if you think about it, makes sense.


I hope this helps everyone. Happy Coding :)


24 Oct 2011

LotusScript Tip: Stop Notes View from reloading in LSScript

   Hi Everyone.
In my previous post, I explained how you could stop a Front-End Document from Reloading if you’re working with a Back-End NotesDocument. In this post, there is a similar issue which occurs with NotesViews.

Let’s say you have a LotusScript Agent which currently loops through documents in a NotesView, and during this loop, new documents are created by users, which get automatically populated into this view whilst you are using it. This annoys me, because either I get errors when working with Doc Collections, or my indexes could possibly get screwed up. The reason documents will automatically get added or removed from this view, is because this View’s Properties could be set to Refresh its Index Automatically. I usually prefer this when creating NotesViews, as it means that the data in the views is always the latest and Real Time.

So, the question is……how can we then stop the Refreshing of the View when working with it in a LotusScript Agent? Simple. When you declare and set the NotesView Object…there is a Property called “AutoUpdate”, which is default to True. Simply set this property to “False” before working with the view. See below Example:

Sub Initialize

    Dim ss As New NotesSession
    Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument

    ‘ CODE
Set db = ss.CurrentDatabase
Set view = db.GetView( “ViewName” )

    view.AutoUpdate = False
Set doc = view.GetFirstDocument

    While Not( doc Is Nothing )
Set doc = view.GetNextDocument( doc )


End Sub