简体   繁体   English

卡桑德拉分区问题

[英]Cassandra partition problems

I am using cassandra db with billions of records, and I want to store data grouped by date. 我正在使用具有数十亿条记录的cassandra db,并且我想存储按日期分组的数据。 The problem is that I should query records with different timezones for users, but it stores data by GMT in partition keys. 问题是我应该为用户查询具有不同时区的记录,但是它通过GMT将数据存储在分区键中。 Is it correct to save different date fields for all timezones and create plenty of views? 为所有时区保存不同的日期字段并创建大量视图是否正确? This would expand db to enormous size. 这将使db扩展到巨大的规模。

I would suggest to make modification of your application layer to perform normalization of the user's date into GMT & perform search, and then convert dates back into user's timezone after retrieval. 我建议对应用程序层进行修改,以将用户的日期标准化为GMT并执行搜索,然后在检索后将日期转换回用户的时区。

But be careful with using dates as partition key - this could create so-called "hot" partitions when all write traffic will hit the same partitions & won't be evenly distributed between nodes. 但是使用日期作为分区键时要小心-当所有写入流量都到达相同的分区并且不会在节点之间平均分配时,这可能会创建所谓的“热”分区。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM