DBMS primary index and secondary index questions

vivekyadav02072002 467 views 14 slides Apr 21, 2024
Slide 1
Slide 1 of 14
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14

About This Presentation

DBMS


Slide Content

Primary Index

Q.Supposethereisaorderedfileof30,000records
storedonadiskwithblocksareofsize1024
bytesandrecordsarefixedlengthandun
spannedoflength100bytes,ofwhichkeyfield
is9bytes,andbothblockandrecordpointers
areofsize6bytes.Supposeifweconstructa
primaryindexonthekeyfieldofthefilethen
findtheaveragenumberofblockstoaccessto
accesstherecord_________.
Practice Question

Clustered Index

Q.Supposethereisaorderedfileof30,000records
storedonadiskwithblocksareofsize1024bytes
andrecordsarefixedlengthandunspannedoflength
100bytes,ofwhichkeyfieldis9bytes,andboth
blockandrecordpointersareofsize6bytes.Suppose
ifweconstructaclusteredindexonthekeyfieldof
thefilethenfindtheaveragenumberofblocksto
accesstoaccesstherecord_________.
(Assumethatthereare1000clustersinthedatafile)
Practice Question

Secondary Index

Q.Supposethereisanorderedfileof30,000
recordsstoredonadiskwithblocksareofsize
1024bytesandrecordsarefixedlengthandun
spannedoflength100bytes,ofwhichkeyfield
is9bytes,andbothblockandrecordpointers
areofsize6bytes.Supposeifweconstructa
secondaryindexonthekeyfieldofthefile,then
findtheaveragenumberofblockstoaccessto
accesstherecord_________.
Practice Question

Multi level Index

Q.Supposethereisanorderedfileof30,000
recordsstoredonadiskwithblocksareofsize
1024bytesandrecordsarefixedlengthandun
spannedoflength100bytes,ofwhichkeyfield
is9bytes,andbothblockandrecordpointers
areofsize6bytes.Supposeifweconstructa
secondaryindexonthekeyfieldofthefile,and
thenconvertedintomultilevelindex,thenfind
thenumberofblockstoaccesstoaccessthe
record_________.
Practice Question

Class RoomPractice Question

Q.Considerafileof16384records.Eachrecordis32bytes
longanditskeyfieldisofsize6bytes.Thefileis
orderedonanon-keyfield,andthefileorganizationis
unspanned.Thefileisstoredinafilesystemwithblock
size1024bytes,andthesizeofablockpointeris10
bytes.Ifthesecondaryindexisbuiltonthekeyfieldof
thefile,andamulti-levelindexschemeisusedtostore
thesecondaryindex,thenumberoffirstlevelandsecond
levelblocksinthemulti-levelindexarerespectively
[GATE-2008][CRPQ-7]
(a)8and0 (b)128and6
(c)256and4 (d)512and5
Previous GATE Question

A data file consisting of 1,50,000 student-records is
stored on a hard disk with block size of 4096 bytes. The
data file is sorted on the primary key RollNo. The size
of a record pointer for this disk is 7 bytes. Each student-
record has a candidate key attribute called ANumof
size 12 bytes.
Suppose an index file with records consisting of two
fields. ANumvalue and the record pointer to the
corresponding student record is built and stored on the
same disk.
Assume that the records of data file and index file are
not split across disk blocks. The number of blocks in
the index file is ________.
[CRPQ-6](GATE-2021-Set2)
Previous GATE Question

GATE-2023
Tags