微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 关于cassandra的复杂查询

几天前我在cassandra数据库引擎上听说过,并在上面搜索一个很好的文档.在研究了cassandra后,我得到的cassandra比其他数据引擎更具可扩展性.
我也在Amazon SimpleDB上阅读,但由于SimpleDB的限制为10GB / table,Google Datastore比Amazon SimpleDB慢,我不想使用它们(Google Datastore,Amazon SimpleDB).因此,为了使我们的网站使用大量数据扩展特别高的写入速率,我喜欢使用Cassandra作为我们的数据引擎.

但在开始使用cassandra之前,我对“如何使用casssandra处理复杂数据”感到困惑.我给你下面的MySQL数据库结构,请阅读这个并给我一个很好的建议.

用户
hasColum ID主要
hasColum email唯一
hasColum FirstName
hasColum LastName

分类
hasColum ID主要
hasColum Parent
hasColum类别

帖子表
hasColum ID主要
hasColum UID索引链接到users-> ID的外键
hasColum CID索引与Category-> ID链接的外键
hasColum标题
hasColum Post Index
hasColum PunDate

评论
hasColum ID主要
hasColum UID索引链接到users-> ID的外键
hasColum PID索引外键链接到Posts-> ID
hasColum评论

用户
hasColum ID主要
hasColum名称

UserToGroup表(仅限多对多关系)
hasColum UID链接到Users-> ID的外键
hasColum GID外键链接到Group-> ID

最后,为了您的信息,我喜欢使用SimpleCassie PHP Class http://code.google.com/p/simpletools-php/
因此,如果您可以使用SimpleCassie给我示例,那将非常有用

解决方法:

cassandra’s wiki data model reference

Unlike with relational systems, where you model entities and relationships and then just add indexes to support whatever queries become necessary, with Cassandra you need to think about what queries you want to support efficiently ahead of time, and model appropriately. Since there are no automatically-provided indexes, you will be much closer to one ColumnFamily per query than you would have been with tables:queries relationally. Don’t be afraid to denormalize accordingly;

goog文章here.

我希望它对你有所帮助.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐