You get a bonus - 1 coin for daily activity. Now you have 1 coin

8.3. Data structures, access methods, data access interfaces

Lecture



The organization of data in the Ingres database differs from the organization of data in System R primarily because at the logical level only relationships are maintained. Multiple indices can be created for each relation, but no special data structures are supported for indices; they are also presented in the form of relations (for which, however, it is already impossible to create indexes).

As we have already noted, each Ingres database relation is stored in a separate UNIX file. Several ways of organizing such files are supported: non-key, based on hashing and index-sequential. For any organization, relations are stored in special "primary" pages of files in the same style as in System R. Accordingly, each tuple has a unique identifier (tid), which is almost directly addressed by the tuple .

In case of non-key organization of the relationship, the file consists of primary pages only. To search for tuples that satisfy the condition of the sample, you need to consistently view all the primary pages of the file. When organizing on the basis of hashing, the file also consists only of primary pages, but the location of the tuples in the pages is determined by the value of the hashing function depending on the key set (part of the tuple). Finally, with the indexing-sequential organization, the tuples of the relationship are entered into a file in ascending order of the established key. For direct access by key, a special index table is maintained in the same file. Note that in the initial versions of Ingres, the ordering of the tuples was not maintained in the dynamics, i.e. could be broken when inserting new or modifying existing tuples. The structure of the relationship can be changed in dynamics by performing a special operator of the QUEL language.

For each of the three types of relationship organization, a set of access functions (access methods) with a fixed interface was maintained. This made it possible to add new access methods without requiring rework of the parts of the system that used them.

Each feature set included the following features:

1) openr (descriptor, mode, relation-name)

This function opens the relation as a UNIX OS file in the mode defined by the value of the mode parameter (read or read and modify). In addition, the descriptor output parameter contains information characterizing the specified relation based on system directories. After executing the openr function, the descriptor parameter is a required input parameter for all other functions.

2) get (descriptor, tid, limit_tid, tuple, next_flag)

If the function is called in the direct sampling mode of the tuple (the value of the next_flag parameter is false), then the tuple with the identifier tid is entered into the output tuple parameter. When called in scan mode (next_flag = true), the function performs a sequential selection of tuples on each call, starting with the tuple with the identifier tid and ending with the tuple with the identifier limit_tid. The initial tid and limit_tid settings are made by the find function.

3) find (descriptor, key, tid, match_mode)

The function sets in the output parameter tid the identifier of the first or last tuple of the relationship, which corresponds to the value of the specified key in accordance with the mode specified by the input parameter match_mode. If the relationship has a non-key structure, or if the specified key value does not correspond to the type of the key attribute of the relationship, the identifier of the physically first (or last) tuple of the relationship is written to tid.

4) paramd (descriptor, access_characteristics_structure)

5) parami (descriptor, access_characteristics_structure)

This pair of functions allows you to learn about key attribute attributes of a relationship, the use of which can optimize access to this relationship. The relevant information is recorded in the access_characteristics_structure output parameter and is used by the system to select the value of the match_mode parameter on subsequent calls to the find function.

6) insert (descriptor, tuple)

The specified tuple is entered into the specified relation in accordance with the structure of the relation and the value of the key fields.

7) replace (descriptor, tid, new_tuple)

8) delete (descriptor, tid)

Functions replace or delete a relation tuple with the specified identifier.

9) closer (descriptor)

The function closes the corresponding UNIX OS file and, possibly, updates the contents of the directory relationship.

Note that the listed functions work only with the specified relation. In particular, if indices are defined for a relation, then they will not be automatically modified when the relationship changes. In addition, the functions do not perform any actions to log changes or synchronize parallel access.


Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

IBM System R — реляционная СУБД

Terms: IBM System R — реляционная СУБД