首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何获取cql查询的tombstone计数?

如何获取cql查询的tombstone计数?
EN

Stack Overflow用户
提问于 2014-11-21 22:22:44
回答 1查看 18.2K关注 0票数 13

我正在尝试评估在我们的应用程序的一个表中创建的tombstones的数量。为此,我尝试使用nodetool cfstats。我是这样做的:

代码语言:javascript
复制
create table demo.test(a int, b int, c int, primary key (a));
insert into demo.test(a, b, c) values(1,2,3);

现在,我正在做与上面相同的插入。因此,我希望创建3个墓碑。但是在运行这个列族的cfstats时,我仍然看到没有创建任何tombstones。

代码语言:javascript
复制
nodetool cfstats demo.test
Average live cells per slice (last five minutes): 0.0
Average tombstones per slice (last five minutes): 0.0

现在我尝试删除该记录,但我仍然没有看到创建任何墓碑。这里有什么我遗漏的东西吗?请提个建议。

顺便说一下其他一些细节,*我们使用的是2.1.1版的Java驱动程序*我们运行的是Cassandra 2.1.0

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-11-22 00:28:44

对于查询的tombstone计数,最好的方法是启用跟踪。这将为您提供查询的深度历史记录,包括必须读取多少块墓碑才能完成查询。这不会给出逻辑删除总数,但很可能与性能调优有关。

在cqlsh中,您可以使用以下命令启用此功能

代码语言:javascript
复制
cqlsh> tracing on;
Now tracing requests.
cqlsh> SELECT * FROM ascii_ks.ascii_cs  where pkey = 'One';

 pkey | ckey1 | data1
------+-------+-------
  One |   One |   One

(1 rows)


Tracing session: 2569d580-719b-11e4-9dd6-557d7f833b69

 activity                                                                 | timestamp    | source    | source_elapsed
--------------------------------------------------------------------------+--------------+-----------+----------------
                                                       execute_cql3_query | 08:26:28,953 | 127.0.0.1 |              0
 Parsing SELECT * FROM ascii_ks.ascii_cs  where pkey = 'One' LIMIT 10000; | 08:26:28,956 | 127.0.0.1 |           2635
                                                      Preparing statement | 08:26:28,960 | 127.0.0.1 |           6951
                             Executing single-partition query on ascii_cs | 08:26:28,962 | 127.0.0.1 |           9097
                                             Acquiring sstable references | 08:26:28,963 | 127.0.0.1 |          10576
                                                Merging memtable contents | 08:26:28,963 | 127.0.0.1 |          10618
                                              Merging data from sstable 1 | 08:26:28,965 | 127.0.0.1 |          12146
                                              Key cache hit for sstable 1 | 08:26:28,965 | 127.0.0.1 |          12257
                                                    Collating all results | 08:26:28,965 | 127.0.0.1 |          12402
                                                         Request complete | 08:26:28,965 | 127.0.0.1 |          12638

http://www.datastax.com/dev/blog/tracing-in-cassandra-1-2

票数 29
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27063508

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档