# Database compaction

Database compaction is a specific type of maintenance that keeps a database as small and efficient as possible. Compacting a database means removing any unused space in its files. There are two types: name file and game file compaction.

### Name file compaction

Over time, you may find a database starts to contain a number of player, event, site or round names that are no longer used in any game. This will often happen after you spellcheck names. The unused names waste space in the name file, and can slow down name searches. Name file compaction removes all names that are not used in any games.

### Game file compaction

Whenever a game is replaced or deleted, wasted space is left in the game file (the largest of the three files in a Scid database). Game file compaction removes all wasted space, leaving no deleted games in the database. Note that this operation is irreversible: after compaction, the deleted games are gone forever!

Game file compaction is also recommended after sorting a database, to keep the order of the game file consistent with the sorted index file.

(Updated: Scid 2.5, June 2001)