Compacting your database

From NeoWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 10:13, 22 October 2009 (edit)
James3359 (Talk | contribs)
(This is a new page(!) with instructions about how to use SQL commands to compact a database.)
← Previous diff
Revision as of 10:14, 22 October 2009 (edit) (undo)
James3359 (Talk | contribs)

Next diff →
Line 5: Line 5:
There are two ways to reclaim this space and repack the indexes. There are two ways to reclaim this space and repack the indexes.
-The first is to execute the command+The first is to execute the SQL command
<tt>SHUTDOWN COMPACT</tt> <tt>SHUTDOWN COMPACT</tt>
The disadvantage of this is that the database engine is, well shutdown. So the Base file would need to be closed and reopened. 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 command +The other is to execute this SQL command
<tt>CHECKPOINT DEFRAG</tt> <tt>CHECKPOINT DEFRAG</tt>
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. 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.

Revision as of 10:14, 22 October 2009

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