Optimizing queries in RethinkDB
Brandon Doran
521

There are four “types” of indexes, instead of the three you mentioned in this article. The fourth one is “geo” index. How relevant that is, can’t say, propably not terribly relevant. And while it’s not an actual index type, you can also create multi indexes of multiple fields, multi-compound index if you will. In this case the index would be array of arrays. Might also be worth noticing, that these indexes are not required to reflect any of the fields of the document. It’s absolutely fine to create an index that is true,false, has a string “bad blog text” or what ever, based on if the writer is “bob” or if any of “Jack’s” did something or if it was written by “bob” and it was monday.

What might be more relevant to the topic, is using between() instead of getAll() to get indexed queries. While I’m not 100% sure it would make a difference here, I think using between() to get a range instead of using getAll() (closer to issuing get() in parallel, and actually, getAll() without defined index defaults to use the primary key index) would be faster.

Like what you read? Give Henrik Andersson a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.