IBM 000-8697 Server User Manual


 
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 necessary SQL privileges can
create an explicit temporary table by executing the SQL statement CREATE
TABLE
with the TEMP keyword. During processing, OnLine user processes
may create implicit temporary tables as part of SQL statement processing. If a
user creates a temporary table by executing a SELECT ... INTO TEMP
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 the CREATE 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
specified, the default sizes are eight pages.
Temporary tables created as part of internal processing or by using the
SELECT ... INTO TEMP 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
OnLine performs 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-110 for a description of what happens when a table
is created.)