Defragmentation Role
So we have a reliable freespace manager, which will keep the database file size to the minimum. But do we still need to bother about defragmentation?
Yes, we do for several reasons:
- When the object is deleted, its space in the database is marked as 'freed'. But 8 bytes of its internal ID stay behind. Defragment cleans all this up by writing all objects to a completely new database file. The resulting file will be smaller and faster.
- Within the database file quite a lot of space is used for transactional processing. Objects are always written to a new slot when they are modified, while their 'old' space is marked as free. Adjacent free slots will be merged on the fly, but free and used slots won't be clustered together unless defragmentation is run.