Questions: Hash Indexes

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

A database table has a hash index on the 'email' column. A developer runs the query: SELECT * FROM users WHERE created_at > '2024-01-01'. Why won't the hash index help with this query?

AHash indexes only work on string columns, not date columns
BHash indexes require an exact key value to hash; the ordering information needed to find all dates above a threshold is destroyed by the hash function
CHash indexes are only used when the table has fewer than 1000 rows
DThe hash index would actually work fine for this range query
Question 2 Multiple Choice

For which of the following query types does a hash index provide a genuine performance advantage over a B-tree index?

ASELECT * FROM orders WHERE amount BETWEEN 100 AND 500
BSELECT * FROM users WHERE name LIKE 'Ali%'
CSELECT * FROM sessions WHERE session_token = 'abc123xyz'
DSELECT * FROM products ORDER BY price ASC
Question 3 True / False

Hash indexes cannot support range queries because the hash function does not preserve the ordering relationship between key values.

TTrue
FFalse
Question 4 True / False

Hash indexes are generally faster than B-tree indexes for most types of database query operations.

TTrue
FFalse
Question 5 Short Answer

Why can't a hash index answer the query WHERE salary > 50000, even if there is a hash index on the salary column?

Think about your answer, then reveal below.