I have a question in my textbook:
When is it preferable to use a dense index rather than a sparse index? Explain your answer.
My first thought was that the dense index would be good when it'd cost a cheap / worthwhile amount of space relevant to the performance gain. When I was googling for the answer (to verify), I found this answer in multiple places
It is preferable to use a dense index instead of a sparse index when the file is not sorted on the indexed field (such as when the index is a secondary index) or when the index file is small compared to the size of memory.
and it's not very clear to me what it's saying.
For the first reason
when the file is not sorted on the indexed field (such as when the index is a secondary index)
What is "the file", and likewise which field is "the indexed field", the field in the primary index or the one in the secondary index? Also just in general, I'm still not sure how this justifies the dense index.
For the second part
when the index file is small compared to the size of memory.
What is "the size of memory" in this context? Is this trying to say what I said? (the dense index is cheap to make?)
I'd really appreciate a better explanation/clarification of the above.