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

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.


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. 

Posted Date: 3/7/2013 6:25:58 AM | Location : United States

Related Discussions:- How many block accesses average saved on using primary index, Assignment Help, Ask Question on How many block accesses average saved on using primary index, Get Answer, Expert's Help, How many block accesses average saved on using primary index Discussions

Write discussion on How many block accesses average saved on using primary index
Your posts are moderated
Related Questions
What is OLTP (Online Transaction Processing)? In OLTP - online transaction processing systems relational database design use the discipline of data modeling and generally follo

What is ODBC ? ODBC - Open DataBase Connectivity which is also denoted by ODBC enable the integration of SQL along with a common-purpose programming language. ODBC expose data

What is a security? Securities are claims on financial assets.  They can be illustrated as "claim checks" which give their owners the right to receive funds in the future.  Sec

What is the main goal of RAID technology? Describe the levels 1 through 5. RAID stands for Redundant Array of Inexpensive (or sometimes "Independent")Disks. RAID is a met

Describe the two types of methods for retrieving rows in Python? Fetchone()- Returns the next row as a sequence Fetch all()- Returns the entire result set like a strin

#question.ERD of any car

One-to-many : An entity in A is related with any number of entities in B. An entity in B is related with at the most one entity in A. Example: Relationship between faculty and d

A set of possible data values is called? A set of possible data values is called as domain.

we need example of 2phase locking

How is the database organised in Oracle? Database organized within Oracle in terms of table and table holds attributes and values. A database consists of one or more logical