Vous êtes sur la page 1sur 4

What is file organization? What are the various file organizational methods?

File organization refers to the relationship of the key of the record to the phy sical 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 app lication or purpose. A logical file may occupy a part of physical file or may extend over more than o ne physical file. The objectives of computer based file organization: Ease of file creation and maintenance Efficient means of storing and retrieving information. The various file organization methods are: Sequential access. Direct or random access. Index sequential access. The selection of a particular method depends on: Type of application. Method of processing. Size of the file. File inquiry capabilities. File volatility. The response time. 1. Sequential access method: Here the records are arranged in the ascending or d escending order or chronological order of a key field which may be numeric or bo th. Since the records are ordered by a key field, there is no storage location i dentification. It is used in applications like payroll management where the file is to be processed in entirety, i.e. each record is processed. Here, to have an access to a particular record, each record must be examined until we get the de sired record. Sequential files are normally created and stored on magnetic tape using batch pr ocessing method. Advantages: Simple to understand. Easy to maintain and organize Loading a record requires only the record key. Relatively inexpensive I/O media and devices can be used. Easy to reconstruct the files. The proportion of file records to be processed is high. Disadvantages: Entire file must be processed, to get specific information. Very low activity rate stored. Transactions must be stored and placed in sequence prior to processing. Data redundancy is high, as same data can be stored at different places with di fferent keys. Impossible to handle random enquiries. 2. Direct access files organization: (Random or relative organization). Files in his type are stored in direct access storage devices such as magnetic disk, usi ng an identifying key. The identifying key relates to tits actual storage positi on in the file. The computer can directly locate the key to find the desired rec ord without having to search through any other record first. Here the records ar e stored randomly, hence the name random file. It uses online system where the r esponse and updation are fast. Advantages: Records can be immediately accessed for updation. Several files can be simultaneously updated during transaction processing. Transaction need not be sorted. Existing records can be amended or modified. Very easy to handle random enquiries. Most suitable for interactive online applications.

Disadvantages: Data may be accidentally erased or over written unless special precautions are taken. Risk of loss of accuracy and breach of security. Special backup and reconstruct ion procedures must be established. Les efficient use of storage space. Expensive hardware and software are required. High complexity in programming. File updation is more difficult when compared to that of sequential method. 3. Indexed sequential access organization: Here the records are stored sequentia lly on a direct access device i.e. magnetic disk and the data is accessible rand omly and sequentially. It covers the positive aspects of both sequential and dir ect access files. The type of file organization is suitable for both batch processing and online p rocessing. Here, the records are organized in sequence foe efficient processing of large ba tch jobs but an index is also used to speed up access to the records. Indexing permit access to selected records without searching the entire file. Advantages: Permits efficient and economic use of sequential processing technique when the activity rate is high. Permits quick access to records, in a relatively efficient way when this activi ty is a fraction of the work load. Disadvantages: Slow retrieval, when compared to other methods. Does not use the storage space efficiently. Hardware and software used are relatively expensive Primary File OrganizationThe logical policy / method used for placing records in to file blocksExample: Studentfile -organized to have students records sortedin increasing order of the rollNovaluesGoal: To ensure that operations performed freq uently on the fileexecute fastconflicting demands may be thereexample: on student file, access based on rollNo and also access based on name may both be frequentwe choose to make rollNo access fastFor making name access fast, additional access structuresare needed.-more details later Different File Organization MethodsWe will discuss Heap files, Sorted files and Hashed filesHeap file:Records are appended to the file as they are insertedSimpl est organizationInsertion -Read the last file block, append the record and write back the block -easyLocating a record given values for any attributerequires sca nning the entire file very costlyHeap files are often used only along with other access structures. Ordering field: The field whose values are used for sorting the records in the d ata fileOrdering key field: An ordering field that is also a keySorted file / Se quential file:Data file whose records are arranged such that the values of the o rdering field are in ascending orderLocating a record given the value X of the o rdering field:Binary search can be performed Address of the nthfile block can be obtained from the file headerO(log N) disk accesses to Very useful file organization, if quick access to the data record isneeded given the value of a single attribute.Hashing field: The attribute on which quick acc ess is needed andon which hashing is performedData file: organized as a buckets with numbers 0,1, , (M 1)(bucket -a block or a few consecutive blocks)Hash functio n h: maps the values from the domain of the hashing attribute to bucket numbers File Organization Physical Database Design: Definition and Explanation: File organization is a technique for storing data on secondary storage devices s o that it can be retrieved easily when needed. It includes the physical order an d layout of records on secondary storage devices. The techniques used to write a

nd Retrieve data to and from the storage devices are called access methods. The Operating System provides the basic access methods and performs the actual input and output operations. On the other hand, DBMS requests to the operating system to write and retrieve the records to and from the storage devices. Data of an organization can be organized differently on physical storage media. The database designer needs to understand the company requirements, several cons traints, including the physical characteristics of the secondary storage devices , available operating systems and file management software, and user needs for s toring and accessing data before deciding which file organization method should be used. Following is the criteria for selecting file organization. Fast access for retrieval. Efficient use of storage space. Protection from failure or data loss. Minimizing need for re-organization. Accommodating growth. Security from un-authorized use. File Organization Methods: Although there are many access methods, but in field of database processing, two basic types of access methods are used. These are: (i) Sequential (ii) Indexed Sequential (i) Sequential File Organization: In sequential file organization, records are stored in a file in a sequence acco rding to the value of key field, called the sequence field. There is no location of individual record. The records are stored on the storage device one after th e other by the value of sequence field. If you want to find out a particular rec ord, you need to scan all records one by one until the required record is obtain ed. The magnetic tape is an example of sequential access storage. In this storag e, the computer accesses a specific record starting from the beginning of tape u p to the required record. It is also not an easy way to insert a new record in t he middle of the file. In sequential file organization, insertion, deletion, and modification operations can be performed by rewriting the entire file. It is ve ry slow process for accessing records. The magnetic tape was used in the early c omputers. (ii) Indexed File Organization: In this type of file organization, records can be stored sequentially or non-seq uentially. The location of individual record is also stored along with data of r ecord. For this purpose, an index is created to keep the track of locations of i ndividual records. An index is just like a table that is used to find out the lo cation of a particular record. Indexed file organization is more effective and f ast in accessing than sequential file organization. Indexed file organization is further divided into two types. (a) Sequential Indexed: In this method, records are stored sequentially, but primary key value is used t o create a simple index also called block, index. This technique is most popular and commonly used for file organization. (b) Non-Sequential Indexed: In non-sequential indexed method, records are kept non-sequentially but a full i ndex or inverted index is created to find out the individual records. The data i n a relation of relational database is often stored using this technique. Accord ing to a property of a relation; tuples of a relation are unordered from top to bottom. It means that tuples in a relation do not have any particular order In a library system, books are not kept is sequence with Author names or title o f books. Instead, they are kept according to a catalog number (or computerized i ndex). The author and title are full indexes, which are further used to find out a catalog number. This catalog number is then used to find the actual position of book Making completion easy and efficient Assuring input meets the intended purpose

Assuring accurate completion Making screens and forms attractive Making input uncomplicated Creating screens and forms that are consistent Designing reports to serve a specific purpose Making reports meaningful to users Delivering the appropriate quantity of reports Providing appropriate output distribution Providing output on time Choosing the most effective output method

Vous aimerez peut-être aussi