Cassandra 墓碑计算多个查询与单个查询

Cassandra tombstones count multiple queries vs single query

我有一个cassandra table定义如下

CREATE TABLE mytable
(
  colA text,
  colB text,
  timeCol timestamp,
  colC text,
  PRIMARY KEY ((colA, colB, timeCol), colC)
) WITH....

我想知道墓碑的数量是否会因以下类型的查询而异:

1. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111

以上查询影响多条记录,(colC的多个值)

2. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111 AND colC = '...'

然而,第二个查询需要为最后一列的每个值执行 colC,而第一个查询负责一次执行删除

Cassandra 会在这两种情况下创建相同数量的墓碑吗?

Cassandra 将为每个删除语句创建一个墓碑。但是,每个语句都会创建不同类型的墓碑。

1. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111

将创建行级墓碑:

{ "key": "00032e2e2e0000032e2e2e000008000000000000006f00", "metadata": { "deletionInfo": { "markedForDeleteAt":1427461335167000,"localDeletionTime":1427461335 } }, "columns": [] }

行级墓碑将确保所有列都将被删除覆盖。

2. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111 AND colC = '...'

创建列逻辑删除:

{ "key": "00032e2e2e0000032e2e2e000008000000000000006f00", "columns": [["...","...:!",1427461572135000,"t",1427461572]] }

这只会删除已保存在此集群键下的值。