HPlogo ALLBASE/SQL Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 10 SQL Statements

CREATE TEMPSPACE

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

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 group and account where the TempSpace is to be located. You must specify both a group name and an account name.

Description

  • If no TempSpaces are defined for a DBEnvironment, sorting is done in the current group.

  • Each TempSpace should belong to a different disk volume set.

  • 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.

  • 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 group specified must be accessible to the DBEnvironment.

    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.

Authorization

You must have DBA authority to use this statement.

Example

TempSpace temporary files are created in SomeGrp.SomeAcct when SQL Statements require sorting.

   CREATE TEMPSPACE ThisTempSpace WITH MAXFILEPAGES = 360,\

                               LOCATION = 'SomeGrp.SomeAcct'

TempSpace temporary files will no longer be available in SomeGrp.SomeAcct, but will be allocated in the current group and account as needed.

   DROP TEMPSPACE ThisTempSpace
Feedback to webmaster