Managing Temporary Files

From InterBase
Jump to: navigation, search

Go Up to Server Configuration

InterBase creates two types of temporary files: sort files and history list files.

The InterBase server creates sort files when the size of the internal sort buffer is not big enough to perform the sort. Each request (for example, CONNECT or CREATE DATABASE) gets and shares the same list of temporary file directories. Each request creates its own temporary files (each has its own I/O file handle). Sort files are released when sort is finished or the request is released. If space runs out in a particular directory, InterBase creates a new temporary file in the next directory from the directory list. If there are no more entries in the directory list, it prints an error message and stops processing the current request.

The InterBase isql client creates the history list files to keep track of the input commands. Each instance creates its own temporary files, which can increase in size until they run out of disk space. Temporary file management is not synchronized between clients. When a client quits, it releases its temporary files.

Configuring History Files

To set the location for history files, define the TMP environment variable on your client machine. This is the only way to define the location of history files. If you do not set the location for the history files by defining the TMP environment variable, an InterBase client uses whatever temporary directory it finds defined for the local system. If no temporary directory is defined, it uses /tmp on a UNIX system or C:\temp on a Windows system.

Configuring Sort Files

You should make sure to have plenty of free space available for temporary sorting operations. The maximum amount of temporary space InterBase needs might be larger than the database itself in some cases.

Temporary sort files are always located on the server where the database is hosted; you should specify temporary directories on disk drives that are physically local to the server (not on mapped drives or network mounted file systems).

There are two ways to specify directories for sort files:

  • You can add an entry to the $InterBase/ibconfig file to enable directory and space definition for sort files. The syntax is:
TMP_DIRECTORY size “pathname”
Important The pathname must be in double quotes, or the config file will fail.
This defines the maximum size in bytes of each sort directory. You can list several directories, each on its own line with its own size specification and can specify a directory more than once with different size configurations. InterBase exhausts the space in each specification before proceeding to the next one.
For example, if you specify dir1 with a size of 5,000,000 bytes, then specify dir2 with 10,000,000 bytes, followed by dir1 with 2,000,000 bytes, InterBase uses dir1 until it reaches the 5,000,000 limit, then uses dir2 until it has filled the 10,000,000 bytes allocated there, and then returns to dir1 where it has another 2,000,000 bytes available. Below are the ibconfig entries that describe this configuration:
TMP_DIRECTORY 5000000 “C:\dir1”
TMP_DIRECTORY 10000000 “D:\dir2”
TMP_DIRECTORY 2000000 “C:\dir1”
  • You can use the INTERBASE_TMP and TMP environment variables to define the location.

If you specify temporary directories in ibconfig, the server uses those values for the sort files and ignores the server environment variable values. If you do not specify configuration of temporary directories in ibconfig, then the server picks a location for a sort file based on the following algorithm:

1. Use the directory defined in INTERBASE_TMP environment variable.
2. If INTERBASE_TMP is not defined, use directory defined in TMP environment variable.
3. If TMP is not defined, default to the /tmp directory (UNIX) or C:\temp (Windows).

Advance To: