Cassandra墓碑计数多个查询与单个查询 [英] Cassandra tombstones count multiple queries vs single query
问题描述
我有一个cassandra表定义如下
I've a cassandra table definition as following
CREATE TABLE mytable
(
colA text,
colB text,
timeCol timestamp,
colC text,
PRIMARY KEY ((colA, colB, timeCol), colC)
) WITH....
我想知道墓碑数是否会因以下类型的查询而异:
I want to know if number of tombstones would vary between following types of queries:
1. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111
以上查询影响多个记录,(多个值colC)
Above query affect multiple records, (multiple values of colC)
2. delete from mytable where colA = '...' AND colB = '...' and timeCol = 111 AND colC = '...'
但是,对于最后一列 colC
的每个值都需要执行第二个查询,而第一个查询在一个执行中处理删除
However, 2nd query needs to be executed for each value of last column colC
, while 1st query takes care of deletion in one execution
Cassandra会在这两种情况下创建相同数量的墓碑吗?
Will Cassandra create same number of tombstones in both the cases?
推荐答案
Cassandra将为每个delete语句创建一个单一的墓碑。但是,每个语句将创建一个不同类型的墓碑。
Cassandra will create a single tombstone for each delete statement. However, each statement will create a different type of tombstone.
1。从mytable中删除colA ='...'AND colB ='...'and timeCol = 111
墓碑:
{
key:00032e2e2e0000032e2e2e000008000000000000006f00,
metadata:{
deletionInfo:{
markedForDeleteAt:1427461335167000,localDeletionTime:1427461335
}
},
columns:[]
}
行级别墓碑将确保所有列都被删除。
Row level tombstones will make sure all columns will be covered with the delete.
2。从mytable中删除colA ='...'AND colB ='...'and timeCol = 111 AND colC ='...'
创建列墓碑:
{
key:00032e2e2e0000032e2e2e000008000000000000006f00,
columns:[[...,...:!,1427461572135000,t,1427461572]]
}
这将只删除在此集群键下保存的值。
This will only delete values that have been saved under this clustering key.
这篇关于Cassandra墓碑计数多个查询与单个查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!