Database System Ch-6
Database System Ch-6
School of ECE
Tertiary memory
Incre
ase
Secondary memory spee
d
&
decr
ease
size
Main memory
Primary
divided into 214=16384 tracks with 128 sectors. There is 4096 bytes
space per sector. Determine the size of the disk.
Bytes per sector = 4,096bytes
Bytes per track = 128*4096 = 524,288bytes
Bytes per surface = 16384*524288 = 858,9934,592bytes
Bytes in disk = 16*8589934592 = 137,438,953,472bytes
Disk Size = 128GB
Seek Time : time taken for read/write head to locate the proper
data times. The data items or values forms sequence of bytes that
INTEGER – 4 Bytes
FLOAT – 4 or 8 Bytes
DATETIME – 8 Bytes
characters’ bytes.
are ignored.
Spanned Un Spanned
A single record can be A single record can be
placed in multiple block placed in one block
3 byte
Disk
10 Byte in a Block
3 byte
Disk
10 Byte in a Block
R1 R3 ………… R6 R1 R3 ………… R6 R2
2
R
disk.
One of its attributes are order. And Also known as Sequential Files .
The records are physically ordered based on the value of the desired
field.
Insertion is expensive: the proper location for the incoming record
needs to be located and space has to be created (may require data
movement) then can only the record be added.
R1 R3 ………… R6 R1 R2 R3 ………… R6
2
R
key. But searching with the other criteria is similar to the heap file
organization.
ordering key.
Block2
Block1
Index Block11
SK BP 100
101
2 B1
……….. 102
21 B2
.
23 B3
.
. .
.
Block12 .
111
.
. 0 112
12 113
i nd 110
F .
.
92 B10 .
101 B11 .
111 B12
121 B13
120
Indexes are auxiliary access structures that are used to speed up the
retrieval of records in response of a certain search condition.
There are two different kinds of indexes:
Ordered Indexes : Sorted order of the values in a key field.
Hash Indexes : Uniform distribution of values across a range of
buckets based on a hash function.
Bucket is nothing one block in a disk
An index record (or index entry ) is a separate file from the data file
that consists of the search key values and pointers to one or more
records.
The search key should be primary index.
Index entry is created for first record of each block, but we are not
created all records
There are two types of ordered indexes namely dense index and
sparse index
Dense Index: has an index record for every search key in the data file.
The number of entries in a dense index is equal to the number of
records in the data file.
A) Dense index
Sparse (Non-dense) Index: has index entry for only the first records in
a block known as anchor record of the block.
The numbers of entries in the index file is equal the number of blocks
for the data file.
NOTE: A single data file can have only one primary or clustering
index
Example:-
Secondary index
Multilevel Indexes single index can not handle large number of block
which leads to multiple disk access.
Outer Index Inner Index Data Block
70 80
10 15
30 40
5-way K1 K2 K3 K4
CP CP CP CP CP
RP RP RP RP
40
15 30
70
5 10 20 35
50 60 80
Rp Rp Rp Rp Rp
Example:
The hash function takes the search keys and uniformly randomizes the
records in the buckets.
Uniform distribution : the hash function assigns each bucket the
same number of search key values from the set of all possible
search key values.
Reading assignment:
A sequential search on the dense primary index search key.
A sequential search on the sparse primary index search key.
A binary search on a dense primary index search key
A binary search on a sparse primary index search key.
hash index
Parser and Translator: The parser part of the Parser and Translator
phase of the query processing is the one that is responsible for
identifying the language tokens such as
SQL keywords,
attribute names,
Relation names in the text query and checks for the query syntax.
♫ The translator then translates the query blocks from the query data
structure into relational algebra expressions.
School of ECE
VALUE<=6000.00)
♫ Index
♫ Resource
♫ Alter
♫ Drop
to the user upon login request; then the user encrypts the
the user.
Network independent.
Transaction transparency.
DBMS independent