Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cassandra/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cassandra 卡桑德拉的读取性能很差_Cassandra_Cql - Fatal编程技术网

Cassandra 卡桑德拉的读取性能很差

Cassandra 卡桑德拉的读取性能很差,cassandra,cql,Cassandra,Cql,在cassandra3.10中,我有一个表包含800万行数据。当我按照以下方式进行查询时:从poc.dream中选择max(glass_id),其中时间

在cassandra3.10中,我有一个表包含800万行数据。当我按照以下方式进行查询时:
从poc.dream中选择max(glass_id),其中时间<'2017-04-01 00:00:00+0000'允许过滤
; 时间属性是表的分区键,我选择的数据大小是7000万。但是我的阅读成绩很差,花了2分钟才得到结果

主键是PK(时间,玻璃标识)

跟踪日志部分如下图所示:

Preparing statement [Native-Transport-Requests-1] | 2017-04-07 14:58:55.598000 | 172.19.16.44 |            247 | 127.0.0.1 
Computing ranges to query [Native-Transport-Requests-1] | 2017-04-07 14:58:55.599000 | 172.19.16.44 |            771 | 127.0.0.1
RANGE_SLICE message received from /172.19.16.44 [MessagingService-Incoming-/172.19.16.44] | 2017-04-07 14:58:55.599000 | 172.19.20.89 |             40 | 127.0.0.1
Submitting range requests on 769 ranges with a concurrency of 1 (0.0 rows per range expected) [Native-Transport-Requests-1] | 2017-04-07 14:58:55.599000 | 172.19.16.44 |            862 | 127.0.0.1
Enqueuing request to /172.19.20.89 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.599000 | 172.19.16.44 |            881 | 127.0.0.1
Submitted 1 concurrent range requests [Native-Transport-Requests-1] | 2017-04-07 14:58:55.599000 | 172.19.16.44 |            899 | 127.0.0.1
Sending RANGE_SLICE message to /172.19.20.89 [MessagingService-Outgoing-/172.19.20.89-Small] | 2017-04-07 14:58:55.599000 | 172.19.16.44 |            937 | 127.0.0.1
Executing seq scan across 0 sstables for (min(-9223372036854775808), max(-9222003595370030342)] [ReadStage-1] | 2017-04-07 14:58:55.600000 | 172.19.20.89 |            369 | 127.0.0.1
Read 0 live and 0 tombstone cells [ReadStage-1] | 2017-04-07 14:58:55.600000 | 172.19.20.89 |            517 | 127.0.0.1
Enqueuing response to /172.19.16.44 [ReadStage-1] | 2017-04-07 14:58:55.600000 | 172.19.20.89 |            575 | 127.0.0.1
Sending REQUEST_RESPONSE message to /172.19.16.44 [MessagingService-Outgoing-/172.19.16.44-Small] | 2017-04-07 14:58:55.600000 | 172.19.20.89 |            977 | 127.0.0.1
REQUEST_RESPONSE message received from /172.19.20.89 [MessagingService-Incoming-/172.19.20.89] | 2017-04-07 14:58:55.601000 | 172.19.16.44 |           3018 | 127.0.0.1
Processing response from /172.19.20.89 [RequestResponseStage-2] | 2017-04-07 14:58:55.601000 | 172.19.16.44 |           3090 | 127.0.0.1
Enqueuing request to /172.19.20.5 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601000 | 172.19.16.44 |           3168 | 127.0.0.1
Enqueuing request to /172.19.20.5 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601000 | 172.19.16.44 |           3198 | 127.0.0.1
Enqueuing request to /172.19.20.89 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601000 | 172.19.16.44 |           3210 | 127.0.0.1
Sending RANGE_SLICE message to /172.19.20.5 [MessagingService-Outgoing-/172.19.20.5-Small] | 2017-04-07 14:58:55.601000 | 172.19.16.44 |           3210 | 127.0.0.1
Enqueuing request to /172.19.20.5 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601001 | 172.19.16.44 |           3222 | 127.0.0.1
Enqueuing request to /172.19.20.89 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601001 | 172.19.16.44 |           3230 | 127.0.0.1
Sending RANGE_SLICE message to /172.19.20.89 [MessagingService-Outgoing-/172.19.20.89-Small] | 2017-04-07 14:58:55.601001 | 172.19.16.44 |           3232 | 127.0.0.1
Enqueuing request to /172.19.20.89 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601001 | 172.19.16.44 |           3240 | 127.0.0.1
Sending RANGE_SLICE message to /172.19.20.5 [MessagingService-Outgoing-/172.19.20.5-Small] | 2017-04-07 14:58:55.601001 | 172.19.16.44 |           3247 | 127.0.0.1
Enqueuing request to /172.19.20.5 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601001 | 172.19.16.44 |           3249 | 127.0.0.1
Enqueuing request to /172.19.20.89 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601001 | 172.19.16.44 |           3257 | 127.0.0.1
Enqueuing request to /172.19.20.5 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601001 | 172.19.16.44 |           3264 | 127.0.0.1
Sending RANGE_SLICE message to /172.19.20.5 [MessagingService-Outgoing-/172.19.20.5-Small] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3267 | 127.0.0.1
Executing seq scan across 0 sstables for (max(-9153807552532774465), max(-9087147317664915466)] [ReadStage-2] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3273 | 127.0.0.1
Enqueuing request to /172.19.20.89 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3273 | 127.0.0.1
Sending RANGE_SLICE message to /172.19.20.89 [MessagingService-Outgoing-/172.19.20.89-Small] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3274 | 127.0.0.1
Enqueuing request to /172.19.20.89 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3285 | 127.0.0.1
Executing seq scan across 0 sstables for (max(-9072913252686483927), max(-9071905664525634895)] [ReadStage-4] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3284 | 127.0.0.1
Sending RANGE_SLICE message to /172.19.20.5 [MessagingService-Outgoing-/172.19.20.5-Small] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3290 | 127.0.0.1
Enqueuing request to /172.19.20.89 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3294 | 127.0.0.1
Sending RANGE_SLICE message to /172.19.20.89 [MessagingService-Outgoing-/172.19.20.89-Small] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3296 | 127.0.0.1
Enqueuing request to /172.19.20.89 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3304 | 127.0.0.1
Sending RANGE_SLICE message to /172.19.20.5 [MessagingService-Outgoing-/172.19.20.5-Small] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3307 | 127.0.0.1
Enqueuing request to /172.19.20.89 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601002 | 172.19.16.44 |           3313 | 127.0.0.1
Sending RANGE_SLICE message to /172.19.20.89 [MessagingService-Outgoing-/172.19.20.89-Small] | 2017-04-07 14:58:55.601003 | 172.19.16.44 |           3319 | 127.0.0.1
Enqueuing request to /172.19.20.5 [Native-Transport-Requests-1] | 2017-04-07 14:58:55.601003 | 172.19.16.44 |           3321 | 127.0.0.1
Read 0 live and 0 tombstone cells [ReadStage-4] | 2017-04-07 14:58:55.601003 | 172.19.16.44 |           3323 | 127.0.0.1
Read 0 live and 0 tombstone cells [ReadStage-2] | 2017-04-07 14:58:55.601003 | 172.19.16.44 |           3323 | 127.0.0.1

您在一个查询中做了两件错误的事情

第一:您没有指定分区键,所以cassandra需要在每个节点上执行查询

第二:您正在使用聚合方法
max()
,该方法扫描所有行(对于您的案例为7000万行),只是为了给您提供最大值


不要使用这种查询,而是更改您的数据模型,以便您可以指定分区键,并指定
glass\u id
作为集群键顺序(按说明)。

您在一个查询中做错了两件事

第一:您没有指定分区键,所以cassandra需要在每个节点上执行查询

第二:您正在使用聚合方法
max()
,该方法扫描所有行(对于您的案例为7000万行),只是为了给您提供最大值


不要使用这种查询,而是更改您的数据模型,以便您可以指定分区键,并指定
glass\u id
作为群集键顺序(按说明)。

在问题中添加表架构在问题中添加表架构谢谢帮助。但实际上,到目前为止,分区键是'time',集群键是'glass_id'。目标是获取glass_id的最大值。您应该更改数据模型谢谢您的帮助。但实际上,到目前为止,分区键是'time',集群键是'glass_id'。目标是获取glass_id的最大值。您应该更改数据模型