|
|
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.
ISQL or Application Programs
CREATE TEMPSPACE TempSpaceName
WITH [MAXFILEPAGES = MaxTempFileSize,]
LOCATION = 'PhysicalLocation'
- 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.
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
file) should fit within the space available in the partition where
the TempSpace is located. Use the HP-UX bdf command to
determine the space available in a partition.
The location and characteristics of the TempSpace are stored in
the system catalog. TempSpace files are physically created only when
needed. When the TempSpace is no longer needed (the present task
completes), the temporary file or files are deleted and the space is
available for use again.
The directory specified must be accessible to the DBEnvironment.
The directory must be accessible to hpdb for both read and
write operations. If this read-write (rw) capability is not
granted or if the directory does not exist when a TempSpace is
created, errors are returned.
If the TempSpace cannot be accessed when a statement requiring
temporary space is issued, a system error is returned due to failure
in opening the temporary file.
To delete the definition of a TempSpace, use the
DROP TEMPSPACE statement.
You must have DBA authority to use this statement. hpdb must
have write permission in the directory where the TempSpace files will reside.
TempSpace temporary files are created in the /sort/PurchDB
directory when SQL Statements require sorting.
CREATE TEMPSPACE ThisTempSpace WITH MAXFILEPAGES = 360,
LOCATION = '/sort/PurchDB'
TempSpace temporary files are no longer available in the /sort/PurchDB,
directory but can be allocated under /tmp as needed.
DROP TEMPSPACE ThisTempSpace
|