I recently upgraded a medium size database (40 Gigabytes) and during the upgrade the system experienced instability which at first I could not understand - after troubleshooting it I came to a better understanding of Temporary Files and how it can cause disk space issues which could result in system instability.
Firebird temp files are created when something needs to be sorted or combined from multiple tables and no index is usable or there is not enough sort memory available - for the most part this will not happen during normal Case Manager operations seeing that the system has been optimized to use indexes on all queries ,however, there are cases where un-optimized queries could be executed for example:
Firebird temp files begin with FB and, by default, they are stored in the Windows /temp directory, when the Firebird server is installed as a service. The Firebird temp directory can be altered and specified in the firebird.conf by defining the parameter, TempDirectories.
In my specific case I came across the issue during an upgrade - a Temp file of about 25 Gigabytes was created during a pretty intensive upgrade statement (specifically statement 5.1.4.0 - 133). The system kept falling over during this statement and I was a bit shell shocked trying to understand why I am not receiving a proper error - looking back it now makes perfect sense.
The C: drive hosted both the operating system and the database - this is not ideal but certainly not uncommon. The available space on the C drive was 25 Gigabytes - during the upgrade statement in question a massive Temp File was created which slowly used up all the available space on the C drive which in turn resulted in Operating System instability. Once the system became unstable the upgrade procedure terminated without giving a clear error - the temp file was actually left-over and I had to manually delete it.
I have to be honest that I rarely think about temp files - going forward I will be more cognizant of these little (or not so little) guys.
I mentioned that I never really think about temp files. The reason for this is that in my twenty years of dealing with hundreds of Firebird deployments I have almost never had any issues with them ,however, now that I have encountered issues I realize that you have to be aware of some best practices. I know that some of my colleagues have been experiencing issues during upgrades - it might very well be related to temp files. Cheers!