ReQL queries are executed on a server
Queries are formed in the client but will be sent to server for execution when you run them. This makes sure there is no network round trip and bandwidth allocation. This provides efficiency in query execution.
We also mentioned in Chapter 1, The RethinkDB Architecture and Data Model, that RethinkDB executes queries in a lazy manner. It only fetches the data asked and required for the query to complete. Here is an example:
r.db('test').table('users').limit(5)
To perform this query, RethinkDB will look for only the five documents only in the users
table. It will perform enough operations to perform the data collection requested in the query. This avoids extra computation costs and CPU cycles.
To provide the highest level of efficiency, RethinkDB automatically parallelizes the query as much as possible across the server, CPU cores, or even data centers. RethinkDB automatically processes the complex queries into stages, parallelizes them...