Location Mode
This topic contains information about the location mode of a physical database structure, CALC, VIA, and Direct location mode.
Location mode is the user-specified method that determines where record occurrences are stored within an area. The following methods are available:
- CALC- A record is stored on or near a page that is calculated by the database engine (DBMS) using the value of the element comprising the CALC key.
- VIA (Clustering)- A set member record is stored on or near the page containing its owner record occurrence. If the owner and member are assigned to different areas, the member record is stored at the same relative position in its area as the owner record is in its area.
- DIRECT- A record is stored on or near a user-specified page.
overflow
.CALC Location Mode
The CALC method is used for:
The VIA location mode is used to group (cluster) records that are likely to be accessed together on the same page or as close to each other as possible. This location mode is also sometimes referred to as
- Randomization - Records are distributed evenly over all the pages in the area using a randomizing algorithm, which minimizes overflow and leaves space for VIA occurrences.
- Direct Retrieval by Symbolic Key- A record occurrence can be retrieved with a single access using its CALC key (rather than by reading all records in an area or searching through an index).
VIA Location Mode
clustering
.At Commonweather, for example, employee expertise is retrieved in conjunction with information about an employee. Therefore, EXPERTISE records are stored through the EMP-EXPERTISE set so that they can be clustered around their owning EMPLOYEE record.
In the following figure, the EMPLOYEE records are randomly located on four pages using the CALC location mode. The EXPERTISE records are located on the same pages as their respective owners in the EMP-EXPERTISE set through the VIA location mode. This enables both employee and expertise information to be retrieved with single-page access.
It is also possible to store records via a system-owned index. In this situation, the target page for a new record is the page of the prior record within the index. Consequently, the indexed record occurrences tend to be physically placed within the area in the same order as their entries occur within the index. If the index is sorted on a symbolic key, the record occurrences tend to be physically sequenced in the order of their respective index key values.
DIRECT location mode allows the user to suggest the page on which to store a record. It is used less frequently than CALC or VIA because it places the burden of locating records on the application program.
DIRECT Location Mode
One use of DIRECT mode is to store records serially in an area, which is accomplished by targeting each new record to the page of the most recently stored record. (The database key of the record just stored is returned to the program). The DBMS either stores the record on the suggested target page or on the next page with sufficient space.