Monday, May 18, 2020

What is FILES of records in DBMS? explain in details. Also explain operation on files


FILES OF RECORDS

l  A file is a sequence  of records, where each record is a collection of data values (or data items).

l  A file descriptor  (or file header ) includes information that describes the file, such as the field names  and their data types, and the addresses of the file blocks on disk.

l  Records are stored on disk blocks. The blocking factor bfr for a file is the (average) number of file records stored in a disk block.

l  A file can have fixed-length  records or variable-length  records.

Operation on Files


       Typical file operations include:

l  OPEN: Readies the file for access, and associates a pointer that will refer to a current  file record at each point in time.

l  FIND: Searches for the first file record that satisfies a certain condition, and makes it the current file record.

l  FINDNEXT: Searches for the next file record (from the current record) that satisfies a certain condition, and makes it the current file record.

l  READ: Reads the current file record into a program variable.

l  INSERT: Inserts a new record into the file, and makes it the current file record.

l  DELETE: Removes the current file record from the file, usually by marking the record to indicate that it is no longer valid.

l  MODIFY: Changes the values of some fields of the current file record.

l  CLOSE: Terminates access to the file.

l  REORGANIZE: Reorganizes the file records. For example, the records marked deleted are physically removed from the file or a new organization of the file records is created.

l  READ_ORDERED: Read the file blocks in order of a specific field of the file.

Unordered Files
l  Also called a heap or a pile  file.

l  New records are inserted at the end of the file.

l  To search for a record, a linear search  through the file records is necessary. This requires reading and searching half the file blocks on the average, and is hence quite expensive.

l  Record insertion is quite efficient.

l  Reading the records in order of a particular field requires sorting the file records.

Ordered Files
l  Also called a sequential file.

l  File records are kept sorted by the values of an ordering field.

l  Insertion is expensive: records must be inserted in the correct order. It is common to keep a separate unordered overflow  (or transaction ) file for new records to improve insertion efficiency; this is periodically merged with the main ordered file.

l  A binary search  can be used to search for a record on its ordering field value. This requires reading and searching log2 of the file blocks on the average, an improvement over linear search.

l  Reading the records in order of the ordering field is quite efficient.
                                                             
                                                              Figure 1 Ordered Files

Hashed files Hashing for disk files is called External Hashing. To continue read about HASHING or HASHED FILES visit my blogger site https://myrdbmsnotes.blogspot.com/2020/05/what-is-hashed-files-in-dbms-explain.html


2 comments:

  1. Nice article on data base management system to watch out if you have some knowledge on dbms !!

    ReplyDelete
    Replies
    1. visit my other post on Database Management System .hope you like and share

      Delete