Multi Map / Reduce index vs. relational join

2019-07-19 01:41发布

问题:

One of the key factors making NoSQL databases more scalable is absense of join operation which is essential part of RDBMS. But at the same time, for example, RavenDb contains Multi Maps / Reduce index feature which looks similar to join.

Why do joins limitate scalability but Multi Maps / Reduce indexes do not while they solve pretty similar tasks?

回答1:

It depends on when you are actually perform the operation. Join operations are usually executed on the fly, which means that your incur the cost at read time. That is expensive, since you are querying far more often than writing.

RavenDB multi map/reduce operations happen on the background, and querying them carry with it no computational cost. Once the index completed, querying it is basically free, and it only does any additional work when data changes.



回答2:

Two misconceptions here that are worth correcting. Firstly, to the extent that NOSQL defines any kind of database paradigm at all (rather than simply being the name of a popular collection of software products) it does not have to mean non-relational. NOSQL simply means not SQL or not just SQL. So a NOSQL database could very well be relational and could support joins.

Secondly, joins don't limit scalability. A join in relational terms is a logical operation and not a physical one. It can be implemented in many different ways, including using Map / Reduce.