Let's compare these indexing techniques.
Hash Tables |
B Trees |
Not suitable for range queries, since they don't keep keys in any order.
So, only suitable for "=" queries (or point queries)
|
Suitable for range queries, since the keys are kept in order.
So, suitable for =, >, >=, <, <=, or BETWEEN operators (range queries)
|
Not Scalable |
Scalable |
More suitable for primary key based lookups. |
Also suitable for primary key based lookups, but Hash Tables are better because of their Time Complexity. |
O(1) performance if the hash function is chosen wisely,and Hash Table is sufficiently large.
Otherwise degrades to O(n). |
Always O(logn) performance. |
Sources: This, this and this.
the query can be answered by scanning only the index if
We just have to scan the index, not the Database file. Hash Table with Chaining, and B+ trees are fine.
Now, we have to output the row count of a specific eno. This can be done by looking at any index.
We aren't asked which will be faster; we're asked if it can be answered. Nor is it given that the query is a range query.
the query can be answered by scanning only the index if
So, Option C