在Cassandra中模型M:M关系的替代方法是什么? [英] What are the alternative ways to model M:M relations in Cassandra?

查看:150
本文介绍了在Cassandra中模型M:M关系的替代方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑需要在Cassandra数据存储中表示的M:M关系。

Consider a M:M relation that needs to be represented in a Cassandra data store.

M:M模型选项是什么?对于每个选择,它是什么时候喜欢?

What M:M modeling options are available? For each alternative, when is it to prefer? What M:M modeling choices have you made in your Cassandra powered projects?

推荐答案

不是使用连接表,而是使用连接表使用rdbms,您将有一个ColumnFamily包含每个X的一个行和一个与它相关联的Y列表,然后是一个包含每个Y的行和与之相关联的每个X的列表的CF。

Instead of using a join table the way you would with an rdbms, you would have one ColumnFamily containing a row for each X and a list of Ys associated with it, then a CF containing a row for each Y and a list of each X associated with it.

如果事实证明你不在乎查询其中一个方向,那么只保留你关心的CF。

If it turns out you don't really care about querying one of those directions then only keep the CF that you do care about.

这篇关于在Cassandra中模型M:M关系的替代方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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