cqlsh> tracing on;cqlsh:gps> select * from gpsfullwithneweststate limit 1;
vehicleno | alarm | altitude | datatype | date | direction | durationstatetime | excrypt | gpslocationlasttime | gpssource | heartbeatlasttime | lat | lon | process_time | state | statelast | systime | time | vec1 | vec2 | vec3 | vehiclecolor
-------------+-------+----------+----------+----------+-----------+-------------------+---------+---------------------+-----------+-------------------+----------+-----------+----------------+-------+-----------+----------------+--------+------+------+------+--------------
14380036847 | 0 | 0 | 4610 | 20170927 | 0 | 345690000 | 0 | 20170927160308 | 5 | 20170927160308 | 38184350 | 115041900 | 20170927184201 | 0 | 4 | 20170927184117 | 160308 | 0 | 0 | 0 | 0
(1 rows)
Tracing session: 39030c60-07bb-11e8-9c1d-b1287cbf2334
activity | timestamp | source | source_elapsed | client
-----------------------------------------------------------------------------------------------------------------------------------+----------------------------+------------+----------------+------------
Execute CQL3 query | 2018-02-02 09:48:53.160000 | 172.20.5.2 | 0 | 172.20.5.2
Parsing select * from gpsfullwithneweststate limit 1; [Native-Transport-Requests-1] | 2018-02-02 09:48:53.162000 | 172.20.5.2 | 2575 | 172.20.5.2
Preparing statement [Native-Transport-Requests-1] | 2018-02-02 09:48:53.163000 | 172.20.5.2 | 2960 | 172.20.5.2
Computing ranges to query [Native-Transport-Requests-1] | 2018-02-02 09:48:53.163000 | 172.20.5.2 | 3254 | 172.20.5.2
Submitting range requests on 769 ranges with a concurrency of 1 (2594.0574 rows per range expected) [Native-Transport-Requests-1] | 2018-02-02 09:48:53.164000 | 172.20.5.2 | 4115 | 172.20.5.2
Enqueuing request to /172.20.5.4 [Native-Transport-Requests-1] | 2018-02-02 09:48:53.164000 | 172.20.5.2 | 4551 | 172.20.5.2
Submitted 1 concurrent range requests [Native-Transport-Requests-1] | 2018-02-02 09:48:53.164000 | 172.20.5.2 | 4753 | 172.20.5.2
Sending RANGE_SLICE message to /172.20.5.4 [MessagingService-Outgoing-/172.20.5.4] | 2018-02-02 09:48:53.165000 | 172.20.5.2 | 5037 | 172.20.5.2
RANGE_SLICE message received from /172.20.5.2 [MessagingService-Incoming-/172.20.5.2] | 2018-02-02 09:48:53.167000 | 172.20.5.4 | 593 | 172.20.5.2
Executing seq scan across 3 sstables for (min(-9223372036854775808), max(-9091283365029498734)] [ReadStage-2] | 2018-02-02 09:48:53.168000 | 172.20.5.4 | 1687 | 172.20.5.2
Read 1 live and 0 tombstone cells [ReadStage-2] | 2018-02-02 09:48:53.170000 | 172.20.5.4 | 3113 | 172.20.5.2
Enqueuing response to /172.20.5.2 [ReadStage-2] | 2018-02-02 09:48:53.170000 | 172.20.5.4 | 3279 | 172.20.5.2
Sending REQUEST_RESPONSE message to /172.20.5.2 [MessagingService-Outgoing-/172.20.5.2] | 2018-02-02 09:48:53.170000 | 172.20.5.4 | 3701 | 172.20.5.2
REQUEST_RESPONSE message received from /172.20.5.4 [MessagingService-Incoming-/172.20.5.4] | 2018-02-02 09:48:53.176000 | 172.20.5.2 | 16458 | 172.20.5.2
Processing response from /172.20.5.4 [RequestResponseStage-2] | 2018-02-02 09:48:53.176000 | 172.20.5.2 | 16714 | 172.20.5.2
Request complete | 2018-02-02 09:48:53.177098 | 172.20.5.2 | 17098 | 172.20.5.2
Cassandra 内部查询不会使用查询优化器,cql语句 tracing on开启, 查看执行过程详情。
https://stackoverflow.com/questions/28697497/apache-cassandra-cql-queries-explain-plan
https://www.datastax.com/dev/blog/tracing-in-cassandra-1-2(Request tracing in Cassandra 1.2)
https://lostechies.com/ryansvihla/2014/09/22/cassandra-query-patterns-not-using-the-in-query-for-multiple-partitions/ (涉及到多个partition分区的查询,不用使用in):一次查询失败,在所有节点重试所有查询;可以用executeAsync替代 执行异步批量查询。