File organisation


Published on

Published in: Technology
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

File organisation

  2. 2. Topics coveredWhat are files?File related keywords.File organization. 1. IntroductionFile organizing methods. 2. Strategy *heap file organization. *sequential files organization. 3. Challenges Forward *indexed file organization. *inverted4. Conclusion file organization. *direct file organization.ComparisonQuiz
  3. 3. FILESA file is a collection of data that is treated as a single unit on a peripheral device.TYPES OF FILES-MASTER FILE It contains record of permanent data types. They are created when you install your business.Work filesa program can work efficiently if a work file is used.-a program can work efficiently if a work file is used.
  4. 4. FILESTRANSACTION FILEContains data which is used to updatethe records of master file. Ex-addressof a customer.Transaction files also serves as audittrails and history of the organization.
  5. 5. BASIC FILE RELATED KEYWORKS•Byte:- It is the smallest addressable unit in computer. A byte isa set of 8 bits andrepresents a character.•Element:- It is a combination of one or more bytes. It isreferred to as a field. A field is actually a physical space on tapeor disk. A roll number, age, name of employee etc. are examplesof it.File: - It is a collection of similar records. The records will havethe same fields butdifferent values in each record. The size of a file is limited bythe size of memoryavailable.
  6. 6. BASIC FILE RELATED KEYWORDS•Database: - It is a set of interrelated files. The files in combination tend to link to a common solution. For example, a studentattendance file, a student result file, a studentadmission file, etc. are related to academic software pertaining tostudents.•Record: - The elements related to are combined into a record. Anemployee has a record with his name, designation, basic pay,allowances, deductions etc. as its fields. A record may have aunique key to identify a record e.g. employee number. Records arerepresented as logical & physical records. A logical recordmaintains a logicalrelationship among all the data items in the record. It is the waythe program or user sees the data. In contrast a physical record isthe way data are recorded on a storage medium.
  7. 7. FILE ORGANIZATIONIt is the methodology which is applied to structured computerfiles. Files contain computer records which can be documentsor information which is stored in a certain way for laterretrieval.File organization refers primarily to the logical arrangementof data in a file system. It should not be confused with thephysical storage of the file in some types of storage media.There are certain basic types of computer file, which caninclude files stored as blocks of data and streams of data,where the information streams out of the file while it is beingread until the end of the file is encountered.
  8. 8. Methods of organizing filesDifferent methods of organizing files-1.Heap2.Sequential3.Indexed-sequential4.Inverted list5.Direct access
  9. 9. Choosing a file organization is a design decision, hence itmust be done having in mind the achievement of goodperformance with respect to the most likely usage of thefile. The criteria usually considered important are: 1. Fast access to single record or collection of relatedrecords. 2. Easy record adding/update/removal, withoutdisrupting . 3. Storage efficiency. 4. Redundancy as a warranty against data corruption.
  10. 10. Heap files(unordered)Basically these files are unordered files. It is the simplest andmost basic type. These files consist of randomly orderedrecords. The records will have no particular order.The operations we can perform on the records are insert,retrieve and delete. The features of the heap file or the pile fileOrganisation are:1.New records can be inserted in any empty space that canaccommodate them.2.When old records are deleted, the occupied space becomesempty and available for any new insertion.3.If updated records grow; they may need to be relocated(moved) to a new empty space. This needs to keep a list ofempty space.
  11. 11. Advantages and disadvantagesAdvantages1.This is a simple file Organisation method.2. Insertion is somehow efficient.3. Good for bulk-loading data into a table.4. Best if file scans are common or insertions arefrequent.Disadvantages1.Retrieval requires a linear search and isinefficient.2. Deletion can result in unused space/need forreorganisation.
  12. 12. Heap file organizationIn the below figure, we can see a sample of heap fileorganization for EMPLOYEE relation which consists of 8records stored in 3 contiguous blocks, each blocks cancontains at most 3 records.
  13. 13. Sequential file organization Sequential file organization•Stored in key sequence.•Adding/deleting requires making new file.•Used as master file.•Records in these files can only be read or writtensequentially.
  14. 14. Sequential file organization•Records are also in sequencewithin each block. To access arecord, previous records withinthe block are scanned. Thussequential record design is bestsuited for “get next” activities,reading one record afteranother without a search delay.•records can be added only atthe end of the file.
  15. 15. Advantages and disadvantagesADVANTAGESSimple file designVery efficient when most of the records must be processede.g. PayrollVery efficient if the data has a natural orderCan be stored on inexpensive devices like magnetic tape.DISADVANTAGESEntire file must be processed even if a single record is to besearched.Transactions have to be sorted before processingOverall processing is slow.
  16. 16. Indexed-sequential organizationEach record of a file has a key field which uniquelyidentifies that record.An index consists of keys and addresses.An indexed sequential file is a sequential file (i.e. sortedinto order of a key field) which has an index.A full index to a file is one in which there is an entry forevery record.When a record is inserted or deleted in a file the datacan be added at any location in the data file. Each indexmust also be updated to reflect the change. For a simplesequential index this may mean rewriting theindex for each insertion.
  17. 17. Indexed-sequential organization
  18. 18. Indexed-sequential organization
  19. 19. Indexed-sequential organizationIndexed sequential files are important forapplications where data needs to be accessed.....Sequentiallyrandomly using the index.An indexed sequential file can only be stored on arandom access devicee.g. magnetic disc, CD.
  20. 20. ADVANTAGES AND DISADVANTAGESAdvantagesProvides flexibility for users who need both type ofaccesses with the same file.Faster than sequential.DisadvantagesExtra storage space for the index is required
  21. 21. Inverted list organizationLike the indexed-sequential storage method, theinverted list organization maintains an index. Thetwo methods differ, however, in the index level andrecord storage. The indexed- sequential methodhas a multiple index for a given key, whereasthe inverted list method has a single index for eachkey type.The records are not necessarily stored in asequence. They are placed in the are data storagearea, but indexes are updated for the record keysand location.
  22. 22. ADVANTAGES AND DISADVANTAGESAdvantagesThe benefits are apparent immediately becausesearching is fastdisadvantagesinverted list files use more media space and thestorage devices get full quickly with this type oforganization.updating is much slower.
  23. 23. Direct/random file organizationRecords are read directly from or written on to thefile.The records are stored at known address.Address is calculated by applying a mathematicalfunction to the key field.A random file would have to be stored on a direct access backing storage medium e.g. magnetic disc, CD, DVDExample : Any information retrieval system. Eg Traintimetable system.
  24. 24. Advantages and disadvantagesAdvantagesAny record can be directly accessed.Speed of record processing is very fast.Up-to-date file because of online updating.Concurrent processing is possible. Transactions need not be sorted.DisadvantagesMore complex than sequential.Does not fully use memory locations.More security and backup problems. Expensive hardware and software are required. System design is complex and costly. File updation is more difficult as compared to sequentialfiles.
  25. 25.
  26. 26. Quiz1.Different types of files area)MasterTransactionBackupb)ArchiveTableReportc)DumpLibrary2. Major criteria for selecting a File organization are1. Method of processing of file2. Size of data3. File inquiry capability4. File volatility5. Response time6. Activity ratio
  27. 27. Quiz3.What is file organization?4.What are advantages of sequential fileorganization?5. True or false (indexed sequential file) The data can be added at any location in the file.6.Give an example of direct file organization?7.Give one advantage and disadvantage of directfile organization?
  28. 28. Thank You