You can build a distributed SQL database on top of FDB, or some other kind of database. It has everything you need to build primary and secondary indexes, including not just transactions but also being able to specify weaker consistency guarantees, the sort of stuff that is useful for internals like, IIRC, building secondary indexes in the background such that they don't conflict (much?) with writes. Its API is very, very nice for this.
For example, there is a MongoDB layer on top of FoundationDB: https://www.foundationdb.org/blog/announcing-document-layer/