System Architecture 2-113

Create a Temporary Table: What Happens on Disk

Create a Temporary Table: What Happens on Disk
After the root dbspace exists, users with the necessarySQL privileges can
create anexplicit temporary table by executing the SQL statement CREATE
TABLE with theTEMP keyword. During processing, OnLine user processes
maycreate implicit temporary tables as part of SQL statement processing. If a
user creates a temporary table by executing aSELECT ... INTOTEMP
statement,OnLine handles the table as if it were an explicit temporary table.

Placement

By default, temporary tables are created in the root dbspace.
Users can create explicit temporary tables in some other dbspace by speci-
fying the dbspace name in theCREATE TABLE statement. Users can also
specify sizes of the initial extent and the next extents for an explicit
temporary table in the statement. If initial and next extent sizes are not
speciļ¬ed, the default sizes are eight pages.
Temporary tables created as part of internal processing or by using the
SELECT ... INTOTEMP statement always reside in the root dbspace. For an
implicit temporary table, the initial and next extent sizes are always eight
pages.

Tracking

The tasks involved in creating temporary tables are similar to the tasks
OnLineperforms when it adds a new permanent table. The key difference is
that temporary tables do not receive an entry in the system catalog for the
database.(Refer to page 2-110for a description of what happens when a table
is created.)