【发布时间】:2015-07-13 12:30:58
【问题描述】:
在这里我得到一个很好的解释后再次问类似的问题 How do secondary indexes work in Cassandra?
CREATE TABLE update_audit (
scopeid bigint,
formid bigint,
time timestamp,
operation int,
record_id bigint,
ipaddress text,
user_id bigint,
value text,
PRIMARY KEY ((scopeid), formid, time)
) WITH CLUSTERING ORDER BY (formid ASC, time DESC)
仅供参考, 操作列可能的值为 1,2 和 3。低基数。
record_link_id 高基数。每个条目都可以是唯一的。
根据How do secondary indexes work in Cassandra? 和The sweet spot for cassandra secondary indexing.,user_id 是索引的最佳候选者
搜索应该基于
- 时间,限制为 100。
- 操作和时间,限制为 100。
- user_id 和 time 限制为 100。
- record_id 和时间限制为 100。
问题
总记录超过 10,000M
哪个最好 - 创建 Index over operation、user_id 和 record_id 并应用限制 100。
1) Does Hidden columnfamily for index operation Will return only 100 results?
2) More seeks will slow down the fetch operation?
OR 创建一个新的列族,其定义类似于
CREATE TABLE audit_operation_idx (
scopeid bigint,
formid bigint,
operation int,
time timeuuid,
PRIMARY KEY ((scopeid), formid, operation, time)
) WITH CLUSTERING ORDER BY (formid ASC, operation ASC, time DESC)
required two select query for single select operation.
所以,如果我要为 operation、user_id 和 record_id 创建新的 columnfamily
我必须进行批量查询才能插入到这四个列族中。
3) Does TCP problems will come? while executing batch query.because writes will be huge.
4) what else should I cover to avoid unnecessary problems.
【问题讨论】:
标签: cassandra datastax cql3 cqlsh cassandra-jdbc