Professional Documents
Culture Documents
CSH2D3/ Sequential File: Team Dosen SBD Genap 2017/2018
CSH2D3/ Sequential File: Team Dosen SBD Genap 2017/2018
CSH2D3/ Sequential File: Team Dosen SBD Genap 2017/2018
Record Fetch(TF)
– Sequential Search
– Binary Search
– Probing Search
8
Sequential Search
Without Log
TF = 2log (b) (s + r + btt + c)
= 2log (n/Bfr) (s + r + btt+ c)
With log
TF = 2log (b) (s + r + btt+ c) + ½ o (R/t’)
= 2log (n/Bfr) (s + r + btt+ c) + ½ o (R/t’)
10
Probing Search
Guess the record position in the file
Do the sequential search from the guessed
position
Notes:
The probing based on probability score
Hard to estimates searching time
Time to Fetch Successor Record (TN)
TN = time to transfer 1 block x probability to find
the record in the same block
= btt . 1/Bfr
= btt/Bfr
= R/t
12
Exercises
Create Sequential File with the following data:
– 2,4,5,9,3,6,1,7,12,8,11
23
Indexed sequential files
Add a single index for sequential file to enhance
searching process based on index attribute.
Can be used for directed access or indexed access
24
Data Structure
Components:
–Main/Primary File
–Index
Overflow
26
Index for Indexed-Sequential File
Indexed file is static, multilevel, block anchors
(+)index : Faster block retrieval
Indexed entry is sorted
For n records, #of entry indexes= n/Bfr
Entry size : V+P byte (V=Key, P = TID Pointer)
27
Index Parameter
29
Overflow Area
Unoccupied, separated area to store new record
Push-Through Algorithm :
– New record is inserted in proper position
– Next record is always inserted at the end of block
– If block is full, push to overflow area
30
Example
Kondisi Awal Insert 075 Insert 129 Insert 676 Insert 063 Insert 156
Main File
Main File
Main File
Main File
Main File
Main File
151-... 151-... 151-... 151-... 151-... 151-...
128-...
Overflow Area
128-...
Overflow Area
128-... 128-...
Overflow Area
128-...
Overflow Area
Overflow Area
Overflow Area
075-... 075-...
156-...
31
The Result
32
Indexed File Performance
Record Size
R = aV+P
a : #of attribute
V : average attribute length
P : additional tombstone size field
# of records for indexed sequential file
n = n m + no
nm : #of records in main file
no : #of records in overflow area
33
Indexed Sequential File Performance
#of first level index entry (i1)
il = nm / Bfr
#of index entry on the next level :
Do reorganization if:
–Overflow area is not empty
–Overflow area is long
–Fetching time is long
Reorganization process
–Read sequentially
–Rewrite all record, except marked for delete
records
–Create index for each block
–Delete old file and index
43
References
Hariyanto, Bambang. “Sistem Pengarsipan dan
Metode Akses”, Bandung: Penerbit Informatika.
2003
Weiderhold, Gio, “File Organization for Database
Design”, New York: McGraaw-Hill Book Co., 1987.
THANK YOU