Indexing Flashcards
describe a disk
organised into tracks and sectors
a track in a sector is a block
contiguous blocks are clusters
what is an index
allows us to access data elements directly.
stored as a separate table.
points to an address
ordered
what is a primary index
primary key
ordered file
fixed length
two fields: key and pointer
what is a secondary index
defined on a field of our choosing
what is a pointer
points to a location in memory
what is an anchor record
the first record in each block of the data file
what is a sparse index
has entries for only some of the search values (less than half)
is a primary index sparse
yes, it only contains keys of anchors rather than every search value
what are the advantages of a sparse index
occupies a smaller space
binary search is faster
more index entries fit on a block
what are clustering indexes
records are physically ordered on a nonkey field
speeds up retrieval
is a clustering index sparse
depends if nonkey field is unique or not
nonkey so CAN be more than value for the field
one entry in the clustering index for each distinct value
pointer to the first block
what are secondary indexes
a means of accessing a data file for which primary access already exists
data doesn’t have to be ordered
created on a candidate or non key field
pointer is either a block or a record pointer
is a secondary index dense
yes
if we create a secondary index on a candidate key…
it will be unique but unordered so the index will be dense.
The index will create an ordering that allows us to perform binary search
if we create a secondary index on a non key field…
there will be duplicates