How to prevent database file fragmentation?

As more data is added, the database file grows and Firebird requests the space from the filesystem. In Firebird versions prior to 2.1 this meant that filesystem would give a new page to Firebird each time it's needed. That can lead to high fragmentation on servers that have a lot of databases or have other programs reading and writing a lot of files.

With Firebird 2.1 there is a configuration option in firebird.conf file to allow preallocating the space in bigger 'chunks' (128MB is the default).

Prior to Firebird 2.1 you can use the trick to simply increase the file size by adding anything to it (zero bytes for example). As Firebird only works with 'pages' it wouldn't mind. Should you decide to do this, make sure you do it when database is not in use (It's safest to shut down the server completely).

Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.

All contents are copyright © 2007-2024 unless otherwise stated in the text.

Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

 Installation and setup
 Backup and restore
 Connectivity and API
 Errors and error codes