如何在Cassandra中将此MySQL表建模为Super ColumnFamily?

[英]How do I model this MySQL table as a Super ColumnFamily in Cassandra?


I'm currently designing a database for a personal project that I'm working on. Actually, I've already designed it, but now I'm converting it from relational (MySQL) to non-relational (Cassandra).

我正在为我正在研究的个人项目设计一个数据库。实际上,我已经设计了它,但现在我将它从关系(MySQL)转换为非关系(Cassandra)。

One of my tables (called "Friend request table") has a primary key that consists of 3 attributes: Receiver ID, Sender ID, and Request time (timestamp). There are 4 other attributes in the table as well:

我的一个表(称为“朋友请求表”)有一个主键,由3个属性组成:接收者ID,发件人ID和请求时间(时间戳)。表中还有4个其他属性:

Receiver ID  (Part of primary key)
Sender ID    (Part of primary key)
Request time (Part of primary key)
Request text
Request status
Time last viewed
Time accepted

I was thinking of having the rows indexed by the result of appending the sender ID to the receiver ID, and having each super column inside the rows indexed by the request time. That would work for storing the requests, but I don't know how I would go about retrieving them.

我正在考虑将发送方ID附加到接收方ID的结果索引的行,并将每个超级列放在由请求时间索引的行内。这可以用于存储请求,但我不知道如何检索它们。

Can anyone suggest another way to model this in Cassandra?

任何人都可以建议另一种方式在卡桑德拉模拟这个吗?

1 个解决方案

#1


3  

Why do you think the answer involves supercolumns? Looks like the most straightforward solution is to model it the same way you would in mysql (with a UUID key) and create indexes on the columns you want to query by.

为什么你认为答案涉及超级列?看起来最直接的解决方案是以与mysql(使用UUID密钥)相同的方式对其进行建模,并在要查询的列上创建索引。

智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2011/03/11/d8cfe16b19cf8eac2a1bdb082a5f079b.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告