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

查看:128
本文介绍了使用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天全站免登陆