Methods to link two pieces of data sequential contiguous storage the next piece

Methods to link two pieces of data sequential

This preview shows page 43 - 52 out of 64 pages.

Methods to link two pieces of data: sequential (contiguous) storage » the next piece of data is stored physically on disk after the previous piece of data use pointers (linked) » the next piece of data is stored physically on disk NOT immediately after the previous piece of data » a pointer is then required to find that next piece of data the pointer “points to” the place on disk where the next piece of data is stored
Image of page 43
File Organizations Technique for physically arranging records of a file on secondary storage Factors for selecting file organization: Fast data retrieval and throughput Efficient storage space utilization Protection from failure and data loss Minimizing need for reorganization Accommodating growth Security from unauthorized use Types of file organizations Sequential (sorted) Indexed (heap) Hashed
Image of page 44
Fig. 5-7a: Sequential File Organization If a file is not sorted : average time to find desired record = n/2 Records of the file are stored in sequence by the primary key field values Since this file is sorted : every insert or delete requires re- sorting the file Why?
Image of page 45
Indexed File Organizations Indexed file organization : the storage of records either sequentially or non-sequentially (heaped) with an index that allows software to locate individual records Index : a separate table used to determine in a file the location of records that satisfy some condition Primary keys are automatically indexed Other fields or combinations of fields can also be indexed; these are called secondary keys (or non-unique keys)
Image of page 46
Fig. 5-7b: Indexed File Organization Uses a tree search: Average time to find desired record = depth of the tree Find the “Flyers”
Image of page 47
Aside from Textbook . . . Index examples
Image of page 48
Indexes Like an index in a book finding specific words within many other words They don’t change the physical order of data the index is simply another table in the database a simple index (table) has only two fields » the first field is the “indexing” (or “search”) field that is, the field you want to search on, like LastName » the second field is a pointer to the block containing the record with that particular indexing field value
Image of page 49
Primary Indexing Example (One Level) Indexing Field Anchor Records Index (table) Primary Key Index Entry 065-89-7735 1 206-56-9618 2 326-78-5236 3 569-12-5536 4 592-48-6019 5 593-21-8129 6 828-84-7924 7 866-24-3881 8 930-52-1832 9 931-54-6604 10 Block # SSN LastName FirstName Phone# 1 065-89-7735 - - - 090-40-9987 - - - 127-80-6034 - - - 137-94-0059 - - - 156-33-4671 - - - 2 206-56-9618 - - - 209-20-4220 - - - 277-22-0802 - - - 278-03-8345 - - - 280-17-1112 - - - 3 326-78-5236 - - - 329-48-7024 - - - 372-04-5833 - - - 391-98-1167 - - - 459-30-4345 - - -
Image of page 50
One Problem . . . Inserting or enlarging records not only must the records in the file on disk be expanded » but also the _____ solution: use » overflow areas (that must be searched linearly) one large “bucket” for the entire file » linked lists (don’t have to be searched linearly) separate overflow areas for each block Deleting or shrinking records use deletion markers (and do the actual delete later) index
Image of page 51
Image of page 52

You've reached the end of your free preview.

Want to read all 64 pages?

  • Summer '19
  • Business, Computer data storage, data integrity

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes