I've seen conflicting advice about extra collations on views (a.k.a. re-sort columns), and some misinformation, so I decided to do a test. I created a view with many documents in it, sorted by one column, then made a copy of the view and added a re-sort to another column. Using the performance measuring technique I described recently, I tested the time it took to do a view rebuild, and used Domino Administrator to look at the view index sizes. The results are shown below:
|View||Time to rebuild index||Size of index|
|Original view with one sorted column||2.9 seconds||1.10M|
|Same view with addition of one "re-sort" column||4.1 seconds||1.67M|
So, a view with one alternate sort takes significantly less resources of CPU and disk space than two separate views of the same documents. If, by adding a re-sort column to one view, you can get rid of another view, you come out way ahead on the deal.
Obviously, there's a significant cost to using this feature, and you shouldn't use it without a reason. But, especially in views containing smaller numbers of documents, the increased user convenience may well be worth the performance cost. You have to evaluate the selection formula and column formulas once for each document, anyway.
I would caution against adding ascending and descending sorts on the same column, because these count as two separate collations (there are reasons we can't just read a single index forward or backward -- I don't want to go into the details, just trust me).
Based on my testing, adding a re-sort on the main sort column (to put it back to the original sort order) costs just as much as a re-sort on any other column. The alternative is to let the user again click the header of the column they sorted, to return to the default sorting.
In version 8.0 and later, there's an option on re-sort columns to defer building the index until someone requests it. This makes it a little cheaper to add sorting options that you think people might want, knowing you won't pay the cost unless it's doing at least one person some good.
Andre Guirard | 10 March 2008 09:00:00 AM ET | Home, Plymouth, MN, USA | Comments (0)