Intermediate
Open
Pro
B-Tree vs Hash Index
You have a sessions table with a token column (UUID, unique per session)
and a user_id column. Your application runs two types of queries:
SELECT * FROM sessions WHERE token = $1(exact lookup, high frequency)SELECT * FROM sessions WHERE user_id = $1 ORDER BY created_at DESC LIMIT 10(range + sort)
Which index type would you choose for each column, and why?