How does a Hash index work?
How does a Hash index work?
A hash index applies a hash function to the indexed value and stores a pointer in a bucket. A lookup hashes the search key, jumps to the bucket and compares the actual values to handle collisions.
hash('alice@example.com') -> bucket 4812 -> [row pointer, ...]
| Hash index | B-tree index | |
|---|---|---|
Equality (=, IN) |
O(1) average | O(log n) |
Range (<, BETWEEN) |
not supported | supported |
ORDER BY / MIN / MAX |
not supported | supported |
Prefix (LIKE 'ab%') |
not supported | supported |
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.