我正在尝试调查使用 cassandra 数组对性能的影响。根据我的实验,cassandra 在插入或不增量更新数组(非冻结)时会生成墓碑。但是根据 cqlsh 跟踪输出,墓碑没有被读取,所以它们不应该对性能产生任何影响......?
CREATE TABLE tomb_test (id text PRIMARY KEY, events list<text>);
insert into tomb_test (id, events) values ('1', ['A', 'B']);
bin$ nodetool flush
-- you can see there is "marked_deleted" tombstone for events array
sstabledump node1/data0/spark/test-ef990510057b11e98254712032ed3bea/mc-1-big-Data.db
[
{
"partition" : {
"key" : [ "1" ],
"position" : 0
},
"rows" : [
{
"type" : "row",
"position" : 62,
"liveness_info" : { "tstamp" : "2018-12-24T14:04:07.188625Z" },
"cells" : [
{ "name" : "events", "deletion_info" : { "marked_deleted" : "2018-12-24T14:04:07.188624Z", "local_delete_time" : "2018-12-24T14:04:07Z" } },
{ "name" : "events", "path" : [ "c7481be0-0784-11e9-8254-712032ed3bea" ], "value" : "A" },
{ "name" : "events", "path" : [ "c7481be1-0784-11e9-8254-712032ed3bea" ], "value" : "B" }
]
}
]
}
]
cqlsh:spark> tracing on
cqlsh:spark> select * from tomb_test ;
-- however when reading from tomb_test, no tombstones are scanned
Read 1 live rows and 0 tombstone cells [ReadStage-3] | 2018-12-24 15:07:02.445000 | 127.0.0.1 | 8357 | 127.0.0.1
PS:当使用冻结列表类型创建表时,不会创建墓碑
CREATE TABLE tomb_test (id text PRIMARY KEY, events frozen<list<text>>);
卡桑德拉版本:3.11.3