Compacting your database

From NeoWiki

Revision as of 10:14, 22 October 2009 by James3359 (Talk | contribs)
Jump to: navigation, search

In the database engine embedded in Base, when records are deleted they are unlinked in the actual tables. The space used by them is not automatically freed and the indexes can be become fragmented over time.

This leads to a degradation of performance.

There are two ways to reclaim this space and repack the indexes.

The first is to execute the SQL command SHUTDOWN COMPACT The disadvantage of this is that the database engine is, well shutdown. So the Base file would need to be closed and reopened.

The other is to execute this SQL command CHECKPOINT DEFRAG In this case the engine is also shutdown to active connections, the space used by deleted records reclaimed and the indexes rebuilt. The engine is then automatically restarted.

Either of these commands can be entered by hand in the SQL window. (From the OpenOffice.org Forum)

To enter the command by hand begin in your main database window. In the Tools menu choose SQL…. This brings up an Execute SQL Statement window. Type the command into the window and then click Execute.

Personal tools