RDB/VMS Relational Database Operator DEFINE_STORAGE_MAP — VMS CDD+_4.1A
Creates a storage map for a relation. A storage map associates a
relation with a particular storage area or areas. The DEFINE STORAGE
MAP statement allows you to specify:
o Which storage areas the records in a relation will be stored in
o Whether an index will be used to choose a target location for
storing the record
o Whether data compression will be enabled when the records are
stored
Example:
RDO> DEFINE STORAGE MAP JOBS_MAP FOR JOBS
cont> STORE WITHIN JOBS
cont> END JOBS_MAP STORAGE MAP.
Additional information available:
Format
DEFINE STORAGE MAP ───────────> map-name ──────────────┐ ┌────────────────────────<─────────────────────────────┘ └──────┬─────────────────────>───────────┬────────────────────┐ └─>
D
E
S
C
R
I
P
T
I
O
N typebox (I)typebox (S) typebox (/)typebox (*) text */ ──┘ │ ┌─────────────────────────────────────────────────────────────┘ └───>
F
O
R ────────────> relation-map-clause ────────────────────┐ ┌───────────────────────────────<───────────────────────────────┘ └──────────>
E
N
D ─────┬───────────────┬─────> typebox (S)typebox (T)typebox (O)typebox (R)typebox (A)typebox (G)typebox (E) typebox (M)typebox (A)typebox (P) ───────> . └─> map-name ───┘
Additional information available:
map-nametextrelation-map-clause
map-name
Specifies the name for the storage map being defined.
text
A text string that adds a comment to the storage map definition.
relation-map-clause
relation-map-clause = ───────> relation-name ──────> typebox (R)typebox (E)typebox (L)typebox (A)typebox (T)typebox (I)typebox (O)typebox (N) ──────────>───────────┐ ┌─────────────────────────────<────────────────────────────┘ │ └──┬──┬─> store-clause ─────────────────────────┬──────┬──> │ ├─>
P
L
A
C
E
M
E
N
T
V
I
A
I
N
D
E
X ───> index-name ──┤ │ │ └────┬──>
D
I
S
A
B
L
E ──┬─>
C
O
M
P
R
E
S
S
I
O
N ──────┘ │ │ └──>
E
N
A
B
L
E ───┘ │ │ │ └──────────────────────────<────────────────────────┘
Additional information available:
relation-namestore-clauseCOMPRESSION clause
relation-name
Specifies the relation to which the storage map will apply. The relation must already be defined and cannot have a storage map associated with it.
store-clause
store-clause = STORE ─┬──>
W
I
T
H
I
N ─┬──> storage-area-name ────┬─────>──────────┬──> ┌──────┘ └─────── typebox (;) <──────────────┘ │ │ │ └─────>
U
S
I
N
G ───┬────> field-name ───┬──
W
I
T
H
I
N ────>──────┐ │ └────────── , ───────┘ │ │ ┌───────────────────────────────<───────────────────────────┘ │ └─┬─>storage-area-name ──>
W
I
T
H
L
I
M
I
T typebox (O)F─┬> literal ─┬─ typebox (;) ──┬─┐ │ │ └──── , <───┘ │ │ │ └──────────────────────────<─────────────────────────────┘ │ │ ┌────────────────────────────<───────────────────────────────┘ │ │ │ └────────────────────> storage-area-name ─────────>─────────────┘
Additional information available:
field-name
The names of the fields whose values will be used as limits for partitioning the relation across multiple storage areas.
storage-area-name
The name of the storage area you want records stored in. You must define this storage area with the DEFINE DATABASE statement before you refer to it in the store clause.
WITH_LIMIT_OF
The WITH LIMIT OF clause specifies the maximum value the key defined in the USING clause can have when it is initially stored in the specified storage area. The number of literals specified must match the number of fields specified in the USING clause. If you change the limits for a storage area, records that were already stored in the area are not moved according to the new limit clause. However, new records will be stored according to the new limits that you specify.
PLACEMENT_VIA_INDEX
Indicates that Rdb/VMS should attempt to store a record in a way that optimizes access to that record via the indicated path. Rdb/VMS chooses a target page for any record being stored by rules that take into account the type of index defined (sorted or hashed), the type of storage areas involved (uniform or mixed) and how indexes and relations are assigned to each other.
COMPRESSION clause
Specifies whether data compression will be enabled or disabled when the records are stored. ENABLE COMPRESSION is the default.
Examples
Example 1
The following statement defines a storage map for the employees
relation in MF_PERSONNEL.
DEFINE STORAGE MAP EMPLOYEES_MAP
DESCRIPTION IS /* EMPLOYEES partitioned by EMPLOYEE_ID */
FOR EMPLOYEES RELATION
STORE USING EMPLOYEE_ID
WITHIN
EMPIDS_LOW WITH LIMIT OF "00200";
EMPIDS_MID WITH LIMIT OF "00400";
EMPIDS_OVER
END EMPLOYEES_MAP STORAGE MAP.
Example 2
The following example shows how to define a storage map that stores
all records from a relation in the named storage area:
RDO> DEFINE STORAGE MAP SALARY_HISTORY_MAP
cont> DESCRIPTION IS /* Map for salary history records */
cont> FOR SALARY_HISTORY RELATION
cont> STORE WITHIN SALARY_HISTORY
cont> END SALARY_HISTORY_MAP STORAGE MAP.
This statement stores all the records from the SALARY_HISTORY
relation into the storage area, SALARY_HISTORY. SALARY_HISTORY is
the name of a storage area that was created with the DEFINE DATABASE
statement.
Example 3
The following example uses the PLACEMENT VIA clause to store records
in a storage area according to a hashed index:
RDO> DEFINE STORAGE MAP DEPARTMENTS_MAP
cont> FOR DEPARTMENTS RELATION
cont> STORE WITHIN DEPARTMENTS
cont> PLACEMENT VIA INDEX DEPARTMENTS_INDEX
cont> END DEPARTMENTS_MAP STORAGE MAP.