File Organization Flashcards
What are the three levels of abstraction in a DBMS
Conceptual Model eg ERD
Logical Model eg Schema tables
Physical Model eg file organization structure
Describe records
Data is usually stored in the form of records.
* Each record consists of a collection of related data values or
items, where each value is formed of one or more bytes and
corresponds to a particular field of the record.
* For example, an EMPLOYEE record would have Name,
Birth_date, Salary, or Supervisor.
What is a record type
A collection of field names and their corresponding data
types constitutes a record type or record format definition
What are the two types of records
-Fixed length record
-Variable length record
Define fixed-length records.
If every record in the file has exactly the same size (in bytes), the
file is said to be made up of fixed-length records.
What are some characteristics of fixed length records
1.All the records in the file are of same size.
2. Leads to memory wastage.
3. Access of the records is easier and faster.
4. Exact location of the records can be determined: location of ith record would be.n*(i-1), where n is the size of every record.
Define variable-length records
If different records in the file have different sizes, the file is said to be made up of variable-length records. We use Separator characters such as(? Or%) to
determine the number of bytes within a particular
record
Give reasons why A file may have variable-length records
- The file records are of the same record type, but one or more of the fields are of varying size (variable-length fields). For example, the Name field of
EMPLOYEE can be a variable-length field. - The file records are of the same record type, but one or more of the fields have a repeating field
- The file records are of the same record type, but one or more of the fields are optional; that is, they may have values for some but not all of the file records(optional fields).
What is blocking
Blocking: refers to storing a number of records in one block on
the disk
What is blocking factor
Blocking factor (bfr) refers to the number of records per block.
* There may be empty space in a block if an integral number of
records do not fit in one block.
*= the size of block/the size of record
*Must be an integer- round down
*Extra space can be used to store metadata (pointers info etc)
* Only applies to fixed length records
What are spanned records
Spanned Records: refer to records that exceed the size of one or more blocks and hence span a number of blocks.
What is a file description
A file descriptor (or file header ) includes information that
describes the file, such as the field names and their data types,
and the addresses of the file blocks on disk
Describe spanned and unspanned blocking and where they are used
File records can be unspanned (no record can span two blocks) or
spanned (a record can be stored in more than one block).
* In a file of fixed-length records, all records have the same format.
Usually, unspanned blocking is used with such files.
* Files of variable-length records require additional information to be stored in each record, such as separator characters and field types. Usually spanned blocking is used with such files.
Describe the different ways physical blocks are stored
The physical disk blocks that are allocated to hold the records of a file can be contiguous (first record of the block is indexed), linked, or indexed (every record is indexed).
What are the shortcomings of contiguous and indexed storage
Contiguous
-Slower in search
Index
-Extra space for storing indexes