How to force caching of Firebird database to file cache of OS
IBSurgeon Team - ?
IBSurgeon Team - ?
[SHOWTOGROUPS=4,20]
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:
In our example, we did gstat for 11Gb database:
And then, RAMMap shows the following
As you can see, the database is fully cached (11Gb, total RAM on this computer is 32Gb).
[/SHOWTOGROUPS]
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:
- Download Для просмотра ссылки Войди
или Зарегистрируйся - 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).
[/SHOWTOGROUPS]