Biblioteca

How to force caching of Firebird database to file cache of OS

As you know, Firebird uses the file cache of OS intensively (especially important on Classic/SuperClassic), and on modern servers, we can often have a lot of RAM, so, potentially, the database file can be 100% cached in RAM.
So, how to force it?
The fastest way to force caching is to run the database statistics command.
Do the following:

  1. Download RAMMap tool
  2. Run it and open tab Files, then sort on size, to see the current allocation of memory, make the screenshot
  3. Run the following command gstat -r localhost:Path/to/your/database -user SYSDBA -pass yourpass > 1.txt  (remember, gstat reads the database from the beginning to the end)
  4. In RAMMap, hit F5 to renew the memory information
In our example, we did gstat for 11Gb database:

gstat -r localhost:Path/to/your/database -user SYSDBA -pass yourpass > 1.txt 


And then, RAMMap shows