0% found this document useful (0 votes)
22 views14 pages

Physical Records

Uploaded by

3amrithamanoj12a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views14 pages

Physical Records

Uploaded by

3amrithamanoj12a
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

DATA COLLECTION

& ANALYSIS
A Lecture Presentation
Amritha Manoj
PHYSICAL RECORDS
Physical files contain the actual data that is stored
on the system, and a description of how data is to
be presented to or received from a program.
They contain only one record format, and one or
more members.
A physical file can have a keyed sequence access
path. This means that data is presented to a
program in a sequence based on one or more key
fields in the file.
LOGICAL RECORDS
Logical files do not contain data. They contain a
description of records found in one or more physical files.
A logical file is a view or representation of one or more
physical files.
Logical files that contain more than one format are
referred to as multi-format logical files.
If your program processes a logical file which contains
more than one record format, you can use a read by
record
BLOCKING FACTOR
The records of a file must be allocated to disk blocks because a
block is the unit of data transfer between disk and memory.
When the block size is larger than the record size, each block
will contain numerous records, although some files may have
unusually large records that cannot fit in one block.
Suppose that the block size is B bytes. For a file of fixed-length
└ ┘
records of size R bytes, with B ≥ R, we can fit bfr = B / R
records per block. The value bfr is called the blocking factor for
the file.
In general, R may not divide B exactly, so we have some unused
space in each block equal to B − (bfr * R) bytes
To utilize this unused space, we can store part of a record on one
block and the rest on another.
A pointer at the end of the first block points to the block
containing the remainder of the record in case it is not the next
consecutive block on disk. This organization is called spanned
because records can span more than one block.
Whenever a record is larger than a block, we must use a
spanned organization. If records are not allowed to cross block
boundaries, the organization is called unspanned.
If the average record is large, it is advantageous to use spanning
to reduce the lost space in each block
For variable-length records using spanned organization, each
block may store a different number of records. In this case, the
blocking factor bfr represents the average number of records
per block for the file.
We can use bfr to calculate the number of blocks b needed for a
file of r records:
b = ⎡ (r/bfr)⎤ blocks
where the ⎡ (x)⎤ (ceiling function) rounds the value x up to the
next integer.
PINNED AND UNPINNED
ORGANIZATION
Pinned Organization:
When a page in the database is "pinned," it
means that it is currently resident in memory and
cannot be removed or replaced by the database
management system's memory management
component.
Pinned pages are typically those that are actively
being used or are necessary for ongoing
database operations.
Pinning a page in memory ensures quick access to the data it
contains, avoiding the need to read it from disk each time it is
required.
Pinned organization can enhance performance in scenarios
where certain pages are frequently accessed, as they remain
readily available in memory.

Unpinned Organization
Conversely, an "unpinned" organization implies that pages in
the database can be freely swapped in and out of memory
by the memory management system.
Unpinned pages are usually those that are not currently in
active use or are deemed less critical for immediate access.
The memory management system may decide to evict
unpinned pages from memory to make space for other
pages or to optimize memory usage.
Unpinned organization allows for more flexibility in memory
management and can adapt to varying workloads and
memory constraints.
HEAP FILES
Records are placed in the file in the order in which they are
inserted, at the end of the file.
Inserting a new record efficiently involves copying the last disk
block of the file into a buffer, adding the new record, and then
rewriting the block. The address of this last file block is updated
in the file header.
Searching a record using any search condition typically involves
a linear search through the file by block, which can be expensive.
On average, if only one record satisfies the search condition, a
program will read and search half the file blocks before finding the
record. If no records or several records satisfy the search condition,
the program must read and search all blocks in the file.
In case of deletion a program must first find its block, copy the block
into a buffer, delete the record from the buffer, and finally rewrite the
block back to the disk. This leaves unused space in the disk block.
Deleting a large number of records in this way results in wasted
storage space. Another technique used for record deletion is to have
an extra byte or bit, called a deletion marker, stored with each record.
A record is deleted by setting the deletion marker to a certain value.
A different value for the marker indicates a valid (not deleted)
record. Search programs consider only valid records in a block
when conducting their search. Both of these deletion techniques
require periodic reorganization of the file to reclaim the unused
space of deleted records
We can use either spanned or unspanned organization for an
unordered file, and it may be used with either fixed-length or
variable-length records. Modifying a variable-length record may
require deleting the old record and inserting a modified record
because the modified record may not fit in its old space on disk.
For a file of unordered fixed-length records using unspanned
blocks and contiguous allocation, it is straightforward to access
any record by its position in the file.
If the file records are numbered 0,1,2,...,r-1 and the records in each
block are numbered 0, 1..., bfr-1, where bfr is the blocking factor,
then the ith record of the file is located in block i mod bfr record
in that block. Such a file is often called a relative or direct file
because records can easily be accessed directly by their relative
positions. Accessing a record by its position does not help locate
a record based on a search condition; however, it facilitates the
construction of access paths on the file, such as the indexes.
THANK YOU

You might also like