Topic 7 file organization
This presentation is the property of its rightful owner.
Sponsored Links
1 / 11

Topic 7: File Organization PowerPoint PPT Presentation


  • 80 Views
  • Uploaded on
  • Presentation posted in: General

Topic 7: File Organization. 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

Download Presentation

Topic 7: File Organization

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Topic 7 file organization

Topic 7: File Organization


Logical vs physical organization of data

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


Definitions

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)


Basics general idea

Basics (General Idea)

  • Records are stored at different places (different indices or locations)

  • To find a record, we need to know its location

  • We can search for the record

    OR

  • Jump to its location directly (if location is known)

    OR

  • A combination of jumping and searching


Sequential file organization

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

  • How do we find a record?

  • What happens when we try to add a new record? (It’s going to be bad…)


Partially indexed sequential files

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

  • Sequential search for key field

  • Directly link to section of records

  • Sequential search for record of interest


Partially indexed sequential files1

Partially-Indexed Sequential Files


Fully indexed files

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


Fully indexed files1

Fully Indexed Files


Direct access file organization

Direct Access File Organization

  • Record address is derived/calculated with math

  • No need to search through an index

  • Example:

    Record Address = UserID MOD 8 + SSN MOD 3

    Record Address = UserID%8 + SSN%3

  • This math operation is called “key hashing” or “hashing”


Fixed length vs variable length records

Fixed-length vs. Variable-length Records

  • Fixed-length

    • each record is a set size

    • can be used with direct access 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


  • Login