TUNING


Compacting databases
When documents and attachments are deleted from a database, Domino® tries to reuse the unused space, rather than immediately reduce the file size. Sometimes Domino will not be able to reuse the space or, because of fragmentation, cannot reuse the space effectively until you compact the database.

There are three styles of compacting:


In-place compacting with space recovery only

This style of compacting recovers unused space in a database but doesn't reduce the size of the database on disk. Databases retain the same database instance IDs (DBIIDs), so the relationship between the compacted databases and the transaction log remains intact. Users and servers can continue to access and edit databases during compacting. This style of compacting is useful for databases that you expect to stay the same size or to grow in size.

When you run Compact without specifying options, Domino uses this style of compacting on all databases enabled for transaction logging. Domino also uses this style of compacting when you use the -b option (case sensitive) when compacting any database.

Tip: Use this compacting method the most frequently -- it is the fastest method and causes the least system impact.

In-place compacting with space recovery and reduction in file size

This style of compacting reduces the file size of databases as well as recovers unused space in databases. This style of compacting is somewhat slower than in-place compacting with space recovery only. This style of compacting assigns new DBIIDs to databases, so if you use it on logged databases and you use a certified backup utility, perform full backups of the databases shortly after compacting is complete. This style of compacting allows users and servers to continue to access and edit databases during compacting.

When you run Compact without specifying options, Domino uses this style of compacting on databases that aren't enabled for transaction logging. Domino also uses this style of compacting when you use the -B option. To optimize disk space, it is recommended that you run Compact using the -B option on all databases once a week or once a month.

Copy-style compacting

Copy-style compacting creates copies of databases and then deletes the original databases after compacting completes, so extra disk space is required to make the database copies. This style of compacting essentially creates a new database with a new database ID. If you use copy-style compacting on logged databases (using the -c option), compacting assigns new DBIIDs, so if you use a certified backup utility, you should perform full backups of databases shortly after compacting completes. When you use copy-style compacting, users and servers can't edit databases during compacting, and they can only read databases if the -L option is used.

Domino uses copy-style compacting by default when you use an option with Compact to enable a database property that requires a structural change to a database or when you run Compact on a database that has a structural change pending that was initiated from the Database Properties box. Enabling or disabling the database properties Document table bitmap optimization and Don't support specialized response hierarchy require structural database changes.

Table 1. Comparison of the three styles of compacting
CharacteristicsIn place, space recoveryIn place, space recovery with file size reductionCopy-style
Databases that use it when compact runs without optionsLogged databases with no pending structural changesUnlogged databases with no pending structural changesDatabases with pending structural changes
Databases you can use it onCurrent® releaseCurrent releaseCurrent release (need -c)
Relative speedFastestMediumSlowest
Users can read databases during compactingYesYesNo (unless -L option used)
Users can edit databases during compactingYesYesNo
Reduction in file sizeNoYesYes
Extra disk space requiredNoNoYes

Renaming a copy-style compacted database

Domino attempts only once to rename a database that was copy-style compacted. You can request successive attempts by specifying the value of the Num_Compact_Rename_Retries setting in the NOTES.INI file. Domino tries to rename until it succeeds or the number of retries is exhausted. For example, to request that Domino try once again to rename, specify Num_Compact_Rename_Retries=1; to request that Domino try 5 more times to rename, specify Num_Compact_Rename_Retries=5.

If you have specified a value for the Num_Compact_Rename_Retries setting, Domino waits 30 seconds before trying to rename a database that was copy-style compacted. You can request a different amount of time to wait by specifying the value of the Compact_Retry_Rename_Wait setting in the NOTES.INI file. For example, to request that Domino wait 2 minutes before trying to rename a database that was copy-style compacted, specify Compact_Retry_Rename_Wait=120.

Domino enforces the following time limit when trying to rename a copy-style compacted database:

Num_Compact_Rename_Retries  x Compact_Retry_Rename_Wait <= 60 minutes

When to compact databases

It's recommended that you compact databases weekly or monthly using the -B option to recover disk space. If you use a certified backup utility, remember to run it after compacting is complete.

Also compact databases to:


Note: The Database - Sizes view of the log file (LOG.NSF), the File Statistic reports generated by the Statistics Collector server task, and the Info tab (i tab) of the Database Properties box, all report the percentage of used space in a database. These are often not accurate indicators of used space; therefore, you shouldn't use them.

Related tasks
Ways to compact databases
Determining the file format of a database
Running the document archiving tool

Related reference
Tools for monitoring database size
Database properties that optimize database performance
Fixup options