使用 NOSQL 进行连接操作 [英] Join operation with NOSQL

查看:10
本文介绍了使用 NOSQL 进行连接操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我浏览了一些关于 Bigtable 和 NOSQL 的文章.非常有趣的是,它们避免了 JOIN 操作.

I have gone through some articles regarding Bigtable and NOSQL. It is very interesting that they avoid JOIN operations.

作为一个基本示例,让我们以 Employee 和 Department 表为例,假设数据分布在多个表/服务器中.

As a basic example, let's take Employee and Department table and assume the data is spread across multiple tables / servers.

只是想知道,如果数据分布在多个服务器上,我们如何进行 JOIN 或 UNION 操作?

Just want to know, if data is spread across multiple servers, how do we do JOIN or UNION operations?

推荐答案

当您有非常大的数据时,您可能希望避免连接.这是因为单个键查找的开销相对较大(服务需要弄清楚要查询哪些节点,并并行查询它们并等待响应).开销是指延迟,而不是吞吐量限制.

When you have extremely large data, you probably want to avoid joins. This is because the overhead of an individual key lookup is relatively large (the service needs to figure out which node(s) to query, and query them in parallel and wait for responses). By overhead, I mean latency, not throughput limitation.

这使得连接非常糟糕,因为您需要进行大量外键查找,最终会到达许多不同的节点(在许多情况下).所以你要避免这种模式.

This makes joins suck really badly as you'd need to do a lot of foreign key lookups, which would end up going to many,many different nodes (in many cases). So you'd want to avoid this as a pattern.

如果它不经常发生,你可能会受到打击,但如果你想做很多事情,那么可能值得对数据进行非规范化".

If it doesn't happen very often, you could probably take the hit, but if you're going to want to do a lot of them, it may be worth "denormalising" the data.

首先,存储在 NoSQL 存储中的东西通常非常异常".在各种不同的地方复制相同的数据以使查找更容易的情况并不少见.

The kind of stuff which gets stored in NoSQL stores is typically pretty "abnormal" in the first place. It is not uncommon to duplicate the same data in all sorts of different places to make lookups easier.

此外,大多数 nosql 也不(真的)支持二级索引,这意味着如果您想通过任何其他条件进行查询,则必须复制内容.

Additionally most nosql don't (really) support secondary indexes either, which means you have to duplicate stuff if you want to query by any other criterion.

如果您要存储员工和部门等数据,则最好使用传统数据库.

If you're storing data such as employees and departments, you're really better off with a conventional database.

这篇关于使用 NOSQL 进行连接操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆