ALLBASE/SQL Reference Manual (36216-90216)

Chapter 10 365
SQL Statements A - D
CREATE TEMPSPACE
CREATE TEMPSPACE
The CREATE TEMPSPACE statement defines and creates a temporary storage space known
as a TempSpace. A TempSpace is a location where ALLBASE/SQL creates temporary files
to store temporary data when performing a sort, if disk space permits.
Scope
ISQL or Application Programs
SQL Syntax
CREATE TEMPSPACE TempSpaceName
WITH [MAXFILEPAGES = MaxTempFileSize,]LOCATION =’PhysicalLocation’
Parameters
TempSpaceName
is the logical name to be assigned to the new TempSpace. More than one
TempSpace can be defined but only one per physical location. All
TempSpace names must be unique within the DBEnvironment.
MaxTempFileSize
specifies the maximum number of 4096-byte pages allocated for each
temporary file in the
PhysicalLocation
. The number of pages must be a
number between 128 and 524,284. The default is 256. Each file may grow
in size up to
MaxTempFileSize
.
PhysicalLocation
identifies the directory
path
where the TempSpace will be located.
The directory must exist prior to defining a TempSpace. A TempSpace is
created relative to the directory where the DBECon file resides unless an
absolute path name is specified.
The maximum length for the path name is 35 bytes.
Description
If no TempSpaces are defined for a DBEnvironment, sorting is done in the /tmp
directory.
It is recommended that each TempSpace reside in a different disk partition. If
TempSpaces are located in different disk partitions, then the disk space of those
partitions is available for creating temporary files. Creating a single TempSpace per
partition is sufficient, because all TempSpaces on a particular partition would share the
space in that partition.
When the size of a temporary file exceeds
MaxTempFileSize
pages, ALLBASE/SQL
opens a temporary file in another defined TempSpace. If additional TempSpace is not
available, then temporary files are created in the same TempSpace, if space permits.
The total temporary space required for a DBEnvironment depends on the size of the
tables to be sorted or indexes to be created. It also depends on the expected number of
concurrent sort operations on the system at one time. The
MaxTempFileSize
(of each