Presentation is loading. Please wait.

Presentation is loading. Please wait.

Topic 7: File Organization. Definitions database  collection of related files file  collection of related records record  collection of related fields.

Similar presentations


Presentation on theme: "Topic 7: File Organization. Definitions database  collection of related files file  collection of related records record  collection of related fields."— Presentation transcript:

1 Topic 7: File Organization

2 Definitions database  collection of related files file  collection of related records record  collection of related fields (e.g. Name, Age) key field  uniquely identifies a record (e.g. UserID)

3 Sequential File Organization Records in a file are stored sequentially (in order) by some key field 2480 Bob 2569 Alice 3020 Paul Originally designed to operate on magnetic tapes What happens when we try to add a new record?

4 Partially-Indexed Sequential Files File index (address) ~ index in a book Partially index all the records Key field has direct index to a section where record of interest is located 1. Sequential search for key field 2. Directly link to section of records 3. Sequential search for record of interest

5 Partially-Indexed Sequential Files KeyRecord Address A1 B6 C11 D16 Record 1 2 3 4 5 6 7 8 9 10 11 12

6 Fully Indexed Files Every record has an index (address) Sequentially search through key field for specific record address Records may be accessed directly OR in sequential order by address

7 Fully Indexed Files KeyRecord Address a4 b7 c5 d3 e12 m9 n10 p2 s11 t6 z1

8 Direct Access File Organization Record address is derived (calculated) from key field No need to search through an index Example: Record Address = UserID MOD 8 + SSN MOD 3 This math operation is called “key hashing” or “hashing”

9 Fixed-length vs. Variable-length Records Fixed-length  each record is a set size  can be used with direct file organization access based on math calculations, so size must be fixed in length Variable-length  each record is a variable size  can be used with sequential file organization access is all indexed, so size does not matter

10 Logical vs. Physical Organization of Data logical organization  the abstract way that the computer program is able to access the data  use of logical structures (e.g. linked lists) physical organization  the actual physical structure of data in memory  i.e. what the sequence of bits look like in memory


Download ppt "Topic 7: File Organization. Definitions database  collection of related files file  collection of related records record  collection of related fields."

Similar presentations


Ads by Google