Preventative Maintenance of
Superbase applications and files
Part of the preventative maintenance of an application is
the periodic inspection and analysis of the data in the tables,
and periodic compacting of the Superbase files and indexes.
When a database deletes records from a table, they aren't
physically deleted from the database itself. A special flag
(that is hidden) is set in each record so that the database
will skip over that record, and not display it or include
it in any operations. However, because it is still inside
of the database, it still takes up space in the database file,
and it still takes up space in this index.
Periodically, it's a good idea to run the REORGANIZE command
against a Superbase database file, to compress the file, physically
purge all records that are flagged as "deleted"
and to compact and compress all structures and indexes.
Although the REORGANIZE command works at the fastest possible
speed, it's affected by the size of the database, the number
of indexes on the database tables, and the speed of the network
connection between your machine and the database file server.
In code, the simplest form of the REORGANIZE command is
REORGANIZE FILE FILE TO FILE
Sometimes, it can be useful to create a maintenance procedure
that opens up each file in turn, and reorganizes the file.
This insures that everything is operating at peak efficiency.
The interactive command for reorganizing a database file
is to select Utilities, Reorganize from the menu system. When
it prompts for a filename, you can give it the same name as
the original file is (typically you reorganize a filename
back to "itself". In some cases (rare) you must
change the filename that you are saving it back to. |