16.20 - TEMPORARY - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Teradata Database
Teradata Vantage NewSQL Engine
Release Number
March 2019
Content Type
Programming Reference
Publication ID
English (United States)
Last Update

Definition for how many bytes are to be allowed by default for creating materialized global temporary tables by users within this database. The number of bytes can be an integer, decimal, or floating point value.

The space used by a global temporary table (table header only) is allocated from the PERM space of the database or user where the global temporary table resides. A CREATE GLOBAL TEMPORARY TABLE request creates table header for the table on each AMP, so the database or user must have adequate PERM space to accommodate the global temporary table header on each AMP. Table header size varies by table definition and the maximum size for a table header can be up to 1 Mbyte.

The space used by the materialized temporary table (table header plus possible data row) is allocated from the login user's temporary space. To materialize a temporary table, the user must have adequate temporary space on each AMP to accommodate the materialized temporary table header and the data row (if the AMP owns the row). Note that the user inherits temporary space from its immediate owner if temporary space was not specified when the user was created.

You can enter the number of bytes as an integer, decimal, or floating point value or as a constant expression whose evaluation determines the number of bytes. You can also enter the value using exponential notation. For example, you can write one thousand as either 1000 or 1E3.
n cannot exceed the temporary space parameter in the profile of the owner. If no temporary space is defined for that profile, then the system uses the temporary space limit defined for the individual user-creator.
A constant expression is any SQL expression that does not make any column references. Specifying an appropriate constant expression for the TEMPORARY space size of a database enables Teradata Database to assign an optimal quantity of TEMPORARY that scales to the size of your system by allocating TEMPORARY space on a per AMP basis.
When you specify a TEMPORARY size based on a constant expression, the assigned size does not automatically scale if, for example, you add more AMPs to your system.
Optional keyword that redundantly specifies the unit for the amount of space allowed.
Keyword that you use to specify a skew limit for TEMPORARY space. You can specify a skew limit percentage that allows the maximum AMP space usage to be above the per-AMP quota, that is, the system maximum space limit divided by the number of AMPs.
Constant expression or constant from 0 through 10000. Specify a value from 1 to 9999 to indicate an AMP-level limit, which is the per-AMP quota * (1+tempskewlimit/100). Specify 0 to set space accounting to the per-AMP level, that is, no skew. A value of 10000 indicates unlimited skew, up to the system maximum space limit.
Use the value of DBS Control DefaultTempSkewLimitPercent.
Optional keyword that you can include for readability to indicate that the constant_expression or DEFAULT keyword specifies a percentage of allowable skew.

Example: Creating a Database with a Temporary Space Skew Limit

For a system with 4 AMPs, you create a database with 1 gigabyte of temporary space. The per-AMP quota of temporary space is 250 megabytes. If you set the temporary skew limit to 20%, any AMP is allowed a skew limit of 50MB above the per-AMP quota of temporary space. An AMP can use up to 300 megabytes of temporary space as long as total temporary space used does not exceed the 1 gigabyte global limit for temporary space.
    PERM = 1e9,