假设我有一张这样的桌子
CREATE TABLE request(
transaction_id text,
request_date timestamp,
data text,
PRIMARY KEY (transaction_id)
);
据我了解,transaction_id 是唯一的该表中的每个分区只有一行我不确定这种情况是否会导致操作系统出现性能问题,也许是因为 Cassandra 为每个分区创建一个文件,导致需要为其托管操作系统管理大量文件,请注意,我不确定 Cassandra 如何创建其文件对于它的桌子。
在这种情况下,我可以通过其 transaction_id 找到请求,例如
select data from request where transaction_id = 'abc';
如果前面的假设是正确的,那么下一个可能会采用不同的方法?
CREATE TABLE request(
the_date date,
transaction_id text,
request_date timestamp,
data text,
PRIMARY KEY ((the_date), transaction_id)
);
场the_date每隔一天都会发生变化,因此表中的分区将为每天创建。
在这种情况下我必须有the_date数据总是可用的发送给客户端,以便我可以使用下一个查询找到请求
select data from request where the_date = '2020-09-23' and transaction_id = 'abc';
预先感谢您的帮助!