1
我的查询是为特定考试获得特定学生的分数。对于卡桑德拉表的设计,选项1,复合分区键 - 行搜索VS.列搜索
CREATE TABLE student_score (
student_name text,
exam_name text,
score int,
exam_time timeuuid
PRIMARY KEY (exam_name,student_name)
)
WITH CLUSTERING ORDER BY (student_name DESC);
EXAM_NAME将分区键,并且所有学生将成为广排。
选项2,
CREATE TABLE student_score (
student_name text,
exam_name text,
score int,
exam_time timeuuid
PRIMARY KEY ((exam_name,student_name))
)
EXAM_NAME和student_name一起形成分区键,因此不存在宽的行。
选项1是标准方式。但选项2有什么问题?
Tks。假设是学生姓名的唯一性。是的,选项1将有潜在的热点问题。除了查询的where子句的区别外,还有什么优点和缺点?像存储,查询速度等 – Hammer
yes查询速度肯定会增加,因为数据不会像选项1那样被过滤掉。选项2将创建类似于RDMS行的结构 –