Professional Documents
Culture Documents
G.S.Gupta
PCMS, Chitawan
Page :1
Unit 3
Filing and filing structure
G.S.Gupta
PCMS, Chitawan
Page :2
Unit 3
Filing and filing structure
G.S.Gupta
PCMS, Chitawan
would be no reason to use the slower, ore expensive memory. In fact, many
early storage devices, including paper tape and core memories, are relegated to
museums now that magnetic tape and semiconductor memory have become
faster and cheaper. Magnetic tapes themselves were used to store active data
back when disks were expensive and had low
File Organization
A file is organized as a sequence of records. These records are mapped onto disk
blocks. Files are provided as a basic construct in operating systems, so we shall
assume the existence of an underlying file system. WE need to consider ways of
representing logical data models in terms of files.
To reduce block-access time, we can organize blocks on disk in a way that
corresponds closely to the way we expect data to be accessed. For example, if we
expect a file to be accessed sequentially, then we should ideally keep all the locks
of the file sequentially on adjacent cylinders. Older operating systems, such as
the IBM mainframe operating systems, provided programmers fine control on
placement of files, allowing a programmer to reserve a set of cylinders for storing
a file.
Subsequent operating systems, such as Unix and personal-computer
operating systems, hide the disk organization from user, and manage the
allocation internally. However, over time, a sequential file may become
fragmented that is, its blocks become scattered all over the disk. To reduce
fragmentation, the system can make a backup copy of the data on disk and
restore the entire disk.
Although blocks are of a fixed size determined by the physical properties of
the disk and by the operating system, record sizes very.
Variable-Length Records
Variable-length records arise in database systems in several ways:
1) Storage of multiple record types in a file
2) Record types that allow variable lengths for one or more fields
3) Record types that allow repeating fields
Byte-String Representation
A simple method for implementing variable-length records is to attach a
special end of-record (??) symbol to the end of each record.
The byte-string representation as described in Figure 11.10 has some
disadvantages:
1) It is not easy to reuse space occupied formerly by a deleted record..
Although techniques exist to manage insertion and deletion, they lead to a
large number of small fragments of disk storage that are wasted.
2) There is no space, in general, for records to grow longer. If a variablelength record becomes longer, it must be moved-movement is costly if
pointers to the record are stored elsewhere in the database (e.g., in
indices, or in other records), since the pointers must be located and
updated.
Page :3
Unit 3
Filing and filing structure
G.S.Gupta
PCMS, Chitawan
Page :4
Unit 3
Filing and filing structure
G.S.Gupta
PCMS, Chitawan
1) Locate the record in the file that comes before the record to be inserted in
search-key order.
2) If there is a free record (that is, space left a deletion) within the same
block as this record, insert the new record there. Otherwise, insert the
new record in an overflow block. In either case, adjust the pointers so as
to chain together the records in search-key order.
Amit
anamika
Bab
Devils
Miners
Data-Dictionary storage
A relational-database system needs to maintain data about the relations, such
as the schema of the relations. This information is called the data dictionary,
or system catalog. Among the types of information that the system must
store are these:
1) Names of the relations
2) Names of the attributes of each attributes
3) Domains and lengths of attributes
4) Names of views defined on the database, and definitions of those views
5) Integrity constraints (for example, key constraints)
Indexed File Organization
In a sequxed file organization, the records are stored either sequentially or
nonsequentially and an index is created that allows the application software to
locate individual records. Like a card atalog in a library, an index is a table that is
used to determine the location of rows in a file that satisfy some condition. Each
index entry matches a key value with one or more records. An index can point to
unique records or to potentially more than one record. An index that allows each
entry to point to more than one record is called a secondary key index.
Secondary key indexes are important for supporting many reporting requirements
and for providing rapid ad hoc data retrieval. An example would be an index on
the Finish field of a product record.
1) Unique primary index (UPI), which is an index on a unique field, possibly the
primary key of the table, and which not only is used to find table rows based
on this field value but also is used by the DBMS to determine where to store
a row based on the primary index field value.
2) Nonunique primary index (NUPI), which is an index on a nonunique field and
which not only is used to find table rows based on this field value but also is
used by the DBMS to determine where to store a row based on the primary
index field value.
Page :5
Unit 3
Filing and filing structure
G.S.Gupta
PCMS, Chitawan
3) Unique secondary index (USI), which is an index on a unique field and which
is used only to find table rows based on this field value.
4) Nonunique secondary index (NUSI), which is an index on a nonunique field
and which is used only to find table rows based on this field value.
F
B
Amit
Anamika
bab
z
H
Devils
miners
Page :6