Basic types of file organisation




















In direct access file, all records are stored in direct access storage device DASD , such as hard disk. The records are randomly placed throughout the file.

The records does not need to be in sequence because they are updated directly and rewritten back in the same location. This file organization is useful for immediate access to large amount of information. It is used in accessing large databases. It is also called as hashing. Advantages of direct access file organization Direct access file helps in online transaction processing system OLTP like online railway reservation system.

In direct access file, sorting of the records are not required. It accesses the desired records immediately. It updates several files quickly.

It has better control over record allocation. Disadvantages of direct access file organization Direct access file does not provide back up facility. It is expensive. It has less storage space as compared to sequential file. Indexed sequential access file organization Indexed sequential access file combines both sequential file and direct access file organization.

In indexed sequential access file, records are stored randomly on a direct access device such as magnetic disk by a primary key. This file have multiple keys. These keys can be alphanumeric in which the records are ordered is called primary key. The data can be access either sequentially or randomly using the index. The main objective of file organization is. There are various methods of file organizations. Hence it is up to the programmer to decide the best suited file organization method depending on his requirement.

See also. Stored at the end of the file. But the address in the memory is random. Frequently joined tables are clubbed into one file based on cluster key. Fast and efficient when there is large volumes of data, Report generation, statistical calculations etc.

Searching records is faster. Suitable for large database. Any of the columns can be used as key column. Grows and shrinks with data. Since all datas are at the leaf node, searching is easy. All data at leaf node are sorted sequential linked list. Best suited for frequently joined tables. Suitable for 1:M mappings. Records are scattered in the memory and they are inefficiently used. Such is the case when many records of a file must be accessed to satisfy a request for data.

In a sequential file, records are maintained in the logical sequence of their primary key values. The processing of a sequential file is conceptually simple but inefficient for random access. However, if access to the file is strictly sequential, a sequential file is suitable.

A sequential file could be stored on a sequential storage device such as a magnetic tape. In a sequential file update, transaction records are in the same sequence as in the master file. Records from both files are matched on the basis of one record at a time, resulting in an updated master file as shown in the fig.

Files may be relatively easy to reconstruct since a good measure of built in back up is usually available. Efficient and economical if the activity rate, i. This method is suitable for the small records. If the record is very big, so much time is consumed in arranging the file. In the inverted file organisation, one index is maintained for each key attribute of the record.

The index file contains the value of the key attribute followed by the addresses of all the records in the main file with the same value of the key attribute. In the example of personnel information for several teachers, say the main file contains the records of six teachers, as follows:. The main file need not contain the values of those attributes for which indices have been maintained since there is already contained in the index file.

The main file may also not be in any particular sequence. It can just be a pile file. The inverted file organisation requires three kinds of files to be maintained, the main file, the Directory files and the index files. The directory file contains the value of the key attributes and the pointer to the first record in the index file where the addresses of all the records in the main file with that value of the key attribute are contained. There is a directory file for each key attribute.

Inverted file is very useful where the list of records with specified values of key attribute is required. For example, we want to have a list of all the teacher posted in Lucknow District or all those teaching physics. Addition of records in the main file can be made at the end of the file since it is not maintained in any sequence.

However, corresponding entries have to be made in all the index files for the key attributes of the record. Changes in key attributes of the record and deletions will also have to be accompanied by corresponding changes in the index files. The maintenance of index files therefore can be very time consuming.

The retrieval of a record from a sequential file, on average, requires access to half the records in the file, making such enquiries not only I inefficient but very time consuming for large files. To improve the query response time of a sequential file, a type of indexing technique can be added.

Indexing associates a set of orderable quantities, which are usually smaller in number or their properties, provide a mechanism for faster search. The purpose of indexing is to expedite the search process. Indexes created from a sequential or sorted set of primary keys are referred to as index sequential. Although the indices and the Data blocks are held together physically, we distinguish between them logically. We shall use the term index file to describe the indexes and data file to refer to the data records.

The index is usually small enough to be read into the processor memory. A sequential for sorted on primary keys file that is indexed is called an index sequential size. The index provides for random access to records, while the sequential nature of the file provides easy access to the subsequent records as well as sequential processing. An additional feature of this file system is the overflow area.

This feature provides additional space for record addition without necessitating the creation of a new file. Permits Quick access to records in a relatively efficient way when this activity is a small fraction of the work load.



0コメント