Hacker News new | ask | show | jobs
by ryanworl 2715 days ago
FDB does not automatically index your data, but you can write a layer (like this one) to index your data.

In a transaction, you write a key like “users/1” with a value of “bob” and then write another key like “users/bob/1” with no value. Then you can do a range scan over the prefix “users/bob/“ and find all the primary keys. After that you do individual gets for the keys in the PK index to retrieve the full record if needed.

The comparison between the two is FDB “secondary indexes” are just like anything else in FDB. Namely, you update them in transactions and they are consistent immediately. Scylla does not AFAIK have this feature.

1 comments

I wrote a blog post on how to implement secondary indexes using an ordered key-value store a couple of years ago: https://misfra.me/2017/01/18/how-to-implement-secondary-inde...

It would work with FoundationDB, RocksDB, etc. I actually learned these techniques when I interned at FoundationDB but have used them the most with other K-V systems.