|< < 27 > >|

Multi-column Hash Indexes

A hash index on (A, B, C) can only be used for equality searches for all of (A, B, C).

E.g. A = 1 and B = 2 and C = 3.

Why?

The index's hash function is something like this:
int index_hash(int a, int b, int c) { return hash(a) ^ hash(b) ^ hash(c); }

  • For A = 1 and B = 2 and C = 3, compute index_hash(1, 2, 3).

  • What would we do for A = 1 and B = 2? Or A > 10?

  • No way to compute a "partial" hash value that lets us find qualifying keys efficiently.

|< < 27 > >|