4.5. Tree Indexes vs. Hash Indexes

Documentation

VoltDB Home » Documentation » Guide to Performance and Customization

4.5. Tree Indexes vs. Hash Indexes

Note the above discussion applies to the VoltDB default tree indexes. You can also define a more specialized hash index, which only covers queries that use equality or "IN" (limited to one "IN" filter per query, as above) to filter all of the keys in the index.

So, a hash index on column A requires a filter that looks like "A = ..." or "A IN ...". A hash index on A, B requires a filter that looks like "A = ... AND B = ..." or "A IN ... and B = ..." or "A = ... AND B IN ..." but will have no effect on only filters like "A = ..." or "A = ... AND B >= ..." etc.

The more flexible default tree indexes are recommended over hash indexes, except in special cases where equality lookup performance on all keys is super-critical and filters on just the prefix key or range filter performance on the complete set of key(s) is not critical. Even under these conditions, we recommend benchmarking hash indexes against tree indexes to verify their benefit for the scale of your data.