Optimizing query performance

Optimizing query performance

Understanding how RethinkDB parallelizes queries can improve the performance of your applications—sometimes significantly.

Sharding

The basic rule is:

Processing happens where the data is until an operation needs to combine it.

In other words, ReQL queries that involve multiple shards will be processed on those shards whenever possible.

Let’s follow the processing of a simple query. (This example uses JavaScript, but the commands are virtually identical in other languages.)

r.table('users').filter({role: 'admin'}).run(conn, callback);

RethinkDB will proc