What are the gds_sort files in my temp directory?

By: Borland Staff

Abstract: They are temp files that are normally deleted

I am seeing a bunch of  gds_sort_a00272 like files in my /tmp directory.
Can I safely delete them?

The information in this article applies to: 
* InterBase v4.x 
* InterBase v5.x

1. What's are these  files named gds_sort_a00272 in the /tmp directory?

They are temporary files InterBase uses to sort data. A sort file is a file that 
holds intermediate results of a large sort.  It's an interbase file because the 
name starts with "gds".  It's a sort file because it includes "_sort_".  It's a 
temp file because the "a_xxxxx" is generated by the mktemp routine.

For InterBase 5.x on Windows platform, the temporary sort files
start with "ib" and are followed by "axxxxxxx".

2. Why are they not removed automatically?

Under normal operation, the sort files are removed at the end of the query operation.  
However, either the InterBase server or the operating system failed abnormally when 
the query was still processing.  The abnormal termination causes the sort files to 
remain in the temp directory.  

So, if you know that there is no user using the sort file, then it's okay to remove these
files from the temp directory.

3. What happens if I remove them?

They go away.

4. Are they important? Do I need to respect them?

Once the sort completes, they're trash.  While the sort is running you 
shouldn't be able to delete them.

5.  How does the system know where to put them?

There are two ways to configure the sort files, located on the server.     

      a.  The location of the temporary sort files is determined by a setting in the InterBase configuration
           file.   It is called isc_config on UNIX systems and IBCONFIG on NT systems.   The setting's
           syntax is :
                   TMP_DIRECTORY size "pathname"
           The configuration file is documented in the InterBase 5.5 Operations Guide on Page 93.   

     b. You can use the INTERBASE_TMP and TMP environment variables to define the location.
          If a temp file location is defined in the InterBase configuration file, that location will be used,
          instead.  If neither INTERBASE_TMP, TMP, or a location in interbase configuration file is undefined,
          then /tmp directory under UNIX or c:temp will be the location of the temporary sort files.

source : Ann Harrison on the list server

Server Response from: ETNASC04