User Manual
Database Cleanup
21 DatabaseCleanup
The Database Cleanup action can result in reduced database size and better
database performance. The following are some scenarios where this action could
be used:
• When a large amount of data is deleted from the database file it leaves behind
empty space. This means the database file might be larger than necessary.
Running the Database Cleanup action reclaims this space and reduces the
size of the database file.
• Frequent inserts, updates, and deletes can cause the database file to become
fragmented, where da ta for a single table or index is scattered around the
database file. Running the Database Cleanup a ction ensures that each table
and index is stored continuously within the database file. Having indexes in
order improves perfo rmance.
Note:
TheDatabaseCleanupactionworksbycopyingthecontentsofthedatabaseintoa
temporarydatabasefileandthenoverw riting theoriginalwiththecontentsofthe
temporaryfile. When overwriting theoriginal,arollbackjournalorwrite-ahead log
WAL file isusedjustasitwouldb e foranyotherdatabasetransaction. Thismeansthat
whenperformingaDatabaseCleanupactiononadatabase,asmuchastwicethesize
oftheoriginal databasefileisrequiredinfreediskspace.
Note:
TheDatabaseCleanupactionwill failifthe
reisanopentransaction,orifthereareone
ormoreactiveSQ L statementswhenitis run
.
Example:
Beforeperforminganexportofa project theprojectsizecouldbes hrunk. Thisisdone
byfirstusingtheClearDataloggeraction,andthentheDatabaseCleanupaction.
Example:
Ifanunusuallybigamount ofdatabasetransactionshasbeenperformed,aDatabase
Cleanupcouldhelpboostdatabaseperformance.
BeijerElectronics, MAEN831P
351