Sunday, March 8, 2009

Why Compact Cannot Reduce File Size

On our Lotus Domino server, it has been defined a scheduled job to perform compact task for the Lotus Notes Mailboxes (NSF files) during non-peak hours. After finishing the compact, I can see that the file’s size of databases was being reduced. Lately, I notice that the file size doesn’t reduce any more.

When I did a “load compact” manually on server, I also see that the file’s size wasn’t reduced and there was no error prompted.

After doing much research on the internet, I realized that the change of behavior was due to the fact that I enabled the transaction logging on the Domino server recently.

Before I dwell down to the point, let me fist highlight that there are three styles of compacting:
[1] In-place compacting with space recovery (means –b option)
[2] In-place compacting with space recovery and reduction in file size (means –B option)
[3] Copy-style compacting


(For detailed description, you may refer to URL http://www-01.ibm.com/support/docview.wss?rs=0&uid=swg27006573)

Here are how Domino works and behaves…

If the transaction logging is not enabled (by default) and when you run Compact without specifying options, Domino uses “In-place with file size reduction” style of compacting on databases. So, the file size of database is reduced.

On the other hand, if the transaction logging is enabled and when you run Compact without specifying options, Domino uses “In-place” style of compacting on databases. That explains why the file size of the database can't not be reduced after the compact done.

So, in order to achieve file’s size reduction, I have explicitly used the “load compact –B” option for compacting the databases.