How to force caching of Firebird database to file cache of OS
As you know, Firebird uses the file cache of OS intensively (especially 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? (please notice, that question "Is it a good idea to force caching" is not discussed here :))
The fastest way to force caching of the database file to the file cache is to run the database statistics command.
Do the following:
Of course, ## 1,2,4 are needed just to see the effect of #3, and work only on Windows.
- Download RAMMap tool
- Run it and open tab Files, then sort on size, to see the current allocation of memory, make the screenshot
- 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, so this operation can take a long time, usually depends on the speed of disks)
- 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 the following
As you can see, the database is fully cached (11Gb, total RAM on this computer is 32Gb).
Like it? Follow Telegram channel FirebirdSQL!