Home | Previous Page | Next Page   Tuning Configuration for Resource Usage > Tuning I/O-Management Parameters for Queries and Transactions >

Managing Temporary Space

The database server uses disk space to store temporary tables created by user applications as well as certain byproducts of query processing, such as files created for the SORT and GROUP BY operations and the overflow of hash joins that do not fit entirely in memory.

When SQL statements create temporary tables, these tables can also be explicitly fragmented in the temporary space that you create. For information on creating temporary tables with explicit fragmentation methods, refer to Temporary Tables That User Applications Create.

Important:
Temporary dbspaces and dbslices are nonlogging spaces. Activity for tables placed in these spaces is not logged. If you need logging, constraints, or indexes on a temporary table, you must use the TEMP keyword in the CREATE TABLE statement and specify a non-temporary space for the table. If applications require such temporary tables, create logging dbspaces and dbslices to store them in addition to the nonlogging spaces that you create for less specialized temporary tables.

Follow the guidelines in this section to configure temporary disk space for your applications.

Temporary Space Guidelines

Temporary space management is primarily an issue for DSS applications. OLTP applications require relatively little temporary space. However, for best performance, use the following guidelines for all applications:

Three general guidelines apply to creating temporary dbspaces for DSS applications:

Estimating Required Temporary Space

Use the following guidelines to estimate the amount of temporary space to create:

Tip:
To monitor the amount of temporary space available and in use, execute onstat -g tmp.

Creating Dbslices for Temporary Tables and Sort Files

In addition to dbslices that you create for tables and logical logs, create dbslices for user-created temporary tables and for the temporary output that is part of DSS query processing.

To create a dbspace for the exclusive use of temporary tables and sort files, use one of the following commands:

For balanced use of resources on coservers, create the temporary dbslices for so that they span all coservers. For information about onutil syntax, see the IBM Informix: Extended Parallel Server Administrator's Reference.

If you expect to store more than 20,000 tables or table fragments in a dbspace, use the FRAGMENTS clause to allow the database server to manage overhead more efficiently. For example, if you expect that 30,000 tables might be stored in the dbspace, execute an onutil CREATE TEMP DBSPACE command similar to the following:

CREATE TEMP DBSPACE dbsp1
FRAGMENTS 30000
CHUNK "/dev/svr8"
SIZE 10000000;

You can also use the FRAGMENTS clause when you create dbspaces for permanent tables.

Specifying Temporary Space Availability

By default, the database server places temporary tables and other temporary output files in all dbspaces except the root dbspace and other dbspaces that contain critical data, which includes logical or physical log files. However, using dbspaces that contain permanent tables can cause I/O problems.

To specify where the database server places temporary tables and query byproduct, use arguments to the DBSPACETEMP configuration parameter. For a list of all methods of setting DBSPACETEMP, refer to the IBM Informix: Extended Parallel Server Administrator's Reference. This section describes the two recommended methods of managing temporary space:

For more information about the DBSPACETEMP configuration parameter, see the IBM Informix: Extended Parallel Server Administrator's Reference.

For information about limiting individual query use of configured temporary space, see Limiting Temporary Space for Individual Query Overflow.

Tip:
User applications can set the DBSPACETEMP environment variable to override the global DBSPACETEMP parameter. This environment variable specifies a comma- or colon-separated list of dbspaces or dbslices in which to place temporary tables for the current session.

Limiting Temporary Space for Individual Query Overflow

If temporary space is limited or a single user might run a query that uses all temporary space and prevents other queries from completing execution, you can limit the amount of configured temporary space that a single query can use for operator overflow on each coserver.

Important:
Limiting temporary space for query overflow does not limit the creation of temporary tables or the ability of the database server to create temporary files to perform GROUP BY and SORT operations.

The DS_TOTAL_TMPSPACE configuration parameter specifies the number of kilobytes of temporary disk space on each coserver that any query can use if query operators, such as hash joins, overflow to disk. For example, you might set DS_TOTAL_TMPSPACE to a quarter of the amount of temporary space that is configured on each coserver to allow more queries to use temporary disk space for overflow.

To change the value for DS_TOTAL_TMPSPACE dynamically, execute onutil SET DS_TOTAL_TMPSPACE as described in the IBM Informix: Administrator's Reference.

To put temporary space limits into effect, execute the SET ENVIRONMENT TMP_SPACE_LIMIT statement for sessions that run queries that you want to limit in this way. If TMP_SPACE_LIMIT is not in effect for a session, DS_TOTAL_TMPSPACE is ignored for queries submitted by the session. For information, see Limiting Temporary Space for Query-Operator Overflow.

Tip:
The DBSPACETEMP, DS_TOTAL_TMPSPACE, and FRAGS_PER_DBS configuration parameters can be tuned with the onutil SET command while the server is running.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]