How many block accesses average saved on using primary index, Database Management System

Assignment Help:

Example 1: An ordered student file (ordering field is enrolment number) has 20,000 records stored on a disk having the Block size as 1 K. Assume that each student record is of 100 bytes, the ordering field is of 8 bytes, and block pointer is also of 8 bytes, find how many block accesses on average may be saved on using primary index.

Answer:

Number of accesses without using Primary Index:

Number of records in the file = 20000

Block size = 1024 bytes

Record size = 100 bytes

Number of records per block = integer value of [1024 / 100] = 10

Number of disk blocks acquired by the file = [Number of records / records per block]

= [20000/10] = 2000

Suppose a block level binary search, it would require log22000 = about11 block accesses.

Number of accesses with Primary Index:

Size of an index entry = 8+8 = 16 bytes

Number of index entries that can be stored per block

= integer value of [1024 / 16] = 64

Number of index entries = number of disk blocks = 2000

Number of index blocks = ceiling of [2000/ 64] = 32

Number of index block transfers to find the value in index blocks = log232 = 5

One block transfer will be needed to get the data records using the index pointer after the needed index value has been located. So total number of block transmits with primary index = 5 + 1 = 6.

Therefore, the Primary index would save about 5 block transmits for the given case.

Are there any drawbacks of using primary index? Yes, a primary index needs the data file to be ordered, this causes troubles during deletion and insertion of records in the file. This difficulty can be taken care of by selecting a suitable file organisation that permits logical ordering only. 


Related Discussions:- How many block accesses average saved on using primary index

Explain the benefit of oom, Explain the benefit of OOM. Main benefits o...

Explain the benefit of OOM. Main benefits of object oriented modeling are development of system become fast, quality of the system get improve. It gives freedom of use of alrea

What is message switching, What is Message switching Message switching ...

What is Message switching Message switching transmits data units which can be arbitrarily long. Packet switching has a utmost packet size, if any message longer than that, it s

How to insert data in your table from another table, How to Insert data in ...

How to Insert data in your table from another table? insert into e.g, To insert tuples from employee into N_emp created above, use following statement Insert into N_emp

Read-set(t) and timestamps-optimistic concurrency contents, read-set(T) : E...

read-set(T) : Each data items that are read by a transaction T Timestamps : for all transaction T, the start-time and the end time are reserved for all the three phases.

What is hash file organization, What is hash file organization? What are t...

What is hash file organization? What are the causes of bucket overflow within a hash file organization? What can be completed to decrease the occurrence of bucket overflow?

Explain two phase locking protocol, Explain Two phase locking protocol ...

Explain Two phase locking protocol A transaction is consider as to follow the two-phase locking protocol if all locking operations precede the first unlock operation in the tra

Differentiate between a unique key and a primary key, Differentiate between...

Differentiate between a unique key and a primary key. - By default, clustered index on column are created by primary key while nonclustered index are created by unique key.

Differentiate between a global and a local temporary table, Differentiate b...

Differentiate between a Global and a Local temporary table? - A local temporary table exists only for the duration of a connection or if defined inside a compound statement, fo

Types of locks, Types of Locks There are two necessary types of locks: ...

Types of Locks There are two necessary types of locks: Binary lock : This locking mechanism has two states for to a data item: locked or unlocked Multiple-mode loc

Answer, what is database management system? & why it is required?

what is database management system? & why it is required?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd