4 ms·
> All queries are fully parallelized Does it means that every query touches all servers ? Or does it sends queries to only a subset of servers when possible ?
by fooyc 14y ago
> All queries are fully parallelized
Does it means that every query touches all servers ? Or does it sends queries to only a subset of servers when possible ? (e.g. range queries on PK)
- jdoliner 14y agoJoe Doliner - RethinkDB engineer here. > Does it means that every query touches all servers ? No. > Or does it sends queries to only a subset of servers when possible ? (e.g. range queries on PK) The query planner distributes the query between the nodes that actually contain the relevant data. Here are a few examples: In your example, a range get on the primary key, the query would touch one copy of each shard of the table. * A more interesting example is a map reduce query. That query will also only touch one copy of each shard of the table but the mapping and reduction phases will also happen on those shards which makes the whole process a lot faster.
- continuations 14y ago> In your example, a range get on the primary key, the query would touch one copy of each shard of the table. But shouldn't it be fewer than "each shard"? Let's say the range is 3 < PK < 7. If all PKs in that range only lives in 2 shards (out of a total of say 10 shards) then the query should only be run in those 2 shards, no? Or will all 10 shards still be touched by the query?
- coffeemug 14y agoCorrect, the query will only touch two shards in this case.
- spf13 14y agoThis is exactly how normal, map reduce and aggregation queries work in a sharded MongoDB cluster. While it's true that on a single node MongoDB map reduce is single threaded, it is parallelized when running on a sharded cluster.