SpacetimeDB icon indicating copy to clipboard operation
SpacetimeDB copied to clipboard

Hash Indexes

Open Centril opened this issue 1 year ago • 2 comments

Centril avatar Apr 18 '24 22:04 Centril

would love to see hash indexes in the spacetimedb

vovacooper avatar Mar 07 '25 10:03 vovacooper

Our most recent integration benchmarks trying out hash indices suggested that they did not actually gain any performance. However, microbenchmarks did suggest that there was a significant speedup.

For cases like entity_id: u32 and friends, we have another type of index already available: #[index(direct)]. It's substantially faster than btree and hash indices for monotonically increasing IDs but performs poorly for randomized data. You may want to look at using direct for your use case.

Centril avatar Mar 12 '25 13:03 Centril

Please elaborate on “cases like entity_id: u32 and friends”, what is the particular case?

I don't see how entity_id would be monotonic without auto_inc, but that's already only useful on primary keys (thus an implicit index).

egormanga avatar Jul 14 '25 09:07 egormanga