Applications that use temporary tables or large sort operations require a large amount of temporary space. To improve performance of these applications, use the DBSPACETEMP configuration parameter or the DBSPACETEMP environment variable to designate one or more dbspaces for temporary tables and sort files.
Depending on how the temporary space is created, the database server uses the following default locations for temporary table and sort files when you do not set DBSPACETEMP:
This action can severely affect I/O to that dbspace. If the root dbspace is mirrored, you encounter a slight double-write performance penalty for I/O to the temporary tables and sort files.
This action can severely affect I/O to the root dbspace. If the root dbspace is mirrored, you encounter a slight double-write performance penalty for I/O to the temporary tables and sort files.
If PSORT_DBTEMP is not set, the database server writes sort files to the operating-system file space in the /tmp directory.
The database server uses the operating-system directory or files to direct any overflow that results from the following database operations:
You can improve performance with the use of temporary dbspaces that you create exclusively to store temporary tables and sort files. It is recommended that you use the DBSPACETEMP configuration parameter and the DBSPACETEMP environment variable to assign these tables and files to temporary dbspaces.
When you specify dbspaces in either the DBSPACETEMP configuration parameter or the DBSPACETEMP environment variable, you gain the following performance advantages:
The database server automatically applies its parallel insert capability to fragment the temporary table across those dbspaces, using a round-robin distribution scheme.
Statement That
Creates Temporary Table |
Database Logged | WITH NO LOG clause | FRAGMENT BY
clause |
Where Temp Table
Created |
---|---|---|---|---|
CREATE TEMP TABLE | Yes | No | No | Root dbspace |
CREATE TEMP TABLE | Yes | Yes | No | One of dbspaces specified in DBSPACETEMP |
CREATE TEMP TABLE | Yes | No | Yes | Cannot create temp table. Error 229/196 |