C H A P T E R
11
Indexing and Hashing
Practice Exercises
11.1 Answer: Reasons for not keeping indices on every attribute include:
•
Every index requires additional CPU time and disk I/O overhead
during inserts and deletions.
•
Indices on non-primary keys might have to be changed on updates,
although an index on the primary key might not (this is because
updates typically do not modify the primary key attributes).
•
Each extra index requires additional storage space.
•
For queries which involve conditions on several search keys, effi-
ciency might not be bad even if only some of the keys have indices
on them. Therefore database performance is improved less by adding
indices when many indices already exist.
11.2
Answer: In general, it is not possible to have two primary indices on
the same relation for different keys because the tuples in a relation would
have to be stored in different order to have same values stored together.
We could accomplish this by storing the relation twice and duplicating all
values, but for a centralized system, this is not efficient.
11.3
Answer: The following were generated by inserting values into the B
+
-
tree in ascending order. A node (other than the root) was never allowed
to have fewer than ⌈n/2⌉ values/pointers.
a.
1