Specify temporary tables in the DBSPACETEMP configuration parameter

The DBSPACETEMP configuration parameter specifies a list of dbspaces in which the database server places temporary tables and sort files by default. Some or all of the dbspaces that you list in this configuration parameter can be temporary dbspaces, which are reserved exclusively to store temporary tables and sort files.

If the database server inserts data into a temporary table through a SELECT INTO TEMP operation that creates the TEMP table, that temporary table uses round-robin distributed storage. Its fragments are created in the temporary dbspaces that are listed in the DBSPACETEMP configuration parameter or in the DBSPACETEMP environment variable. For example, the following query uses round-robin distributed storage:
SELECT col1 FROM tab1 
   INTO TEMP temptab1 WITH NO LOG;
The DBSPACETEMP configuration parameter lets the database administrator restrict which dbspaces the database server uses for temporary storage.
Important: The DBSPACETEMP configuration parameter is not set in the onconfig.std file. For best performance with temporary tables and sort files, use DBSPACETEMP to specify two or more dbspaces on separate disks.
Tips:
  • If you work on a small system with a limited number of disks and cannot place temporary dbspaces on different disk drives, you might consider using 1 (or possibly 2) temporary dbspaces. This can reduce the logging that is associated with the temporary dbspaces.
  • If you have many disk drives, you can parallelize many operations (such as sorts, joins, and temporary tables) without having multiple temporary dbspaces. The number of temporary dbspaces that you have relates to how much you want to spread the I/O out. A good starting place is 4 temporary dbspaces. If you create too many small temporary dbspaces, you will not have enough space for nonparallel creation of large objects.