Relative direct file organization
Data must be maintained across program executions. This requires storage devices that retain information when the computer is restarted. File organization refers to the relationship of the key of the record to the physical location of that record in the computer file. File organization may be either physical file or a logical file. A physical file is a physical unit, such as magnetic tape or a disk. A logical file on the other hand is a complete set of records for a specific application or purpose.
A logical file may occupy a part of physical file or may extend over more than one physical file. Sequential access method: Here the records are arranged in the ascending or descending order or chronological order of a key field which may be numeric or both.
Since the records are ordered by a key field, there is no storage location identification. It is used in applications like payroll management where the file is to be processed in entirety, i. Here, to have an access to a particular record, each record must be examined until we get the desired record. Sequential files are normally created and stored on magnetic tape using batch processing method.
Direct access files organization: Random or relative organization. Files in his type are stored in direct access storage devices such as magnetic disk, using an identifying key. The identifying key relates to its actual storage position in the file. When every tuple in the relation has to be retrieved in any order every time the relation is accessed. For example, retrieve the name of all the students.
Heap files are inappropriate when only selected tuples of a relation are to be accessed. In a hash file, records are not stored sequentially in a file instead a hash function is used to calculate the address of the page in which the record is to be stored.
The field on which hash function is calculated is called as Hash field and if that field acts as the key of the relation then it is called as Hash key. Records are randomly distributed in the file so it is also called as Random or Direct files. Commonly some arithmetic function is applied to the hash field so that records will be evenly distributed throughout the file. Hash is a good storage structure in the following situations:. When tuples are retrieve based on an exact match on the hash field value, particularly if the access order is random.
Hash is not a good storage structure in the following situations:. When tuples are retrieved based on a range of values for the hash field. When tuples re retrieved based on a field other than the hash field. When tuples are retrieved based on only part of the hash field.
When the hash field frequently updated. When a hash field updated, the DBMS must deleted the entire tuple and possible relocate it to a new address if the has function results in a new address.
Thus, frequent updating of the hash field impacts performance. However, there may be frequent access to this relation based on the Roll Number attribute.
In this case, we may decide to add Roll Number as a secondary index. There is an overhead involved in the maintenance and use of secondary indexes that has to be balanced against the performance improvement gained when retrieving data. This overhead includes:. In an ISAM system, data is organized into records which are composed of fixed length fields. Records are stored sequentially. It is a data structure that allows the DBMS to locate particular records in a file more quickly and thereby speed response to user queries.
An index in a database is similar to an index in a book. File Volatility File activity specifies percent of actual records which proceed in a single run. File volatility addresses the properties of record changes. It helps to increase the efficiency of disk design than tape. File Organization File organization ensures that records are available for processing. It is used to determine an efficient file organization for each base relation.
For example, if we want to retrieve employee records in alphabetical order of name. Sorting the file by employee name is a good file organization. However, if we want to retrieve all employees whose marks are in a certain range, a file is ordered by employee name would not be a good file organization.
Types of File Organization There are three types of organizing the file: 1. Sequential access file organization 2. Direct access file organization 3. Indexed sequential access file organization 1. Sequential access file organization Storing and sorting in contiguous block within files on tape or disk is called as sequential access file organization. In sequential access file organization, all records are stored in a sequential order.
Improve Article. Save Article. Like Article. Recommended Articles. Article Contributed By :. Smitha Dinesh Semwal. Easy Normal Medium Hard Expert. Writing code in comment? Please use ide. Load Comments. What's New.
0コメント