简体   繁体   English

服务器端警告:使用没有分区键的聚合查询

[英]Server-side warning: Aggregation query used without partition key

While using the C/C++ driver of Cassandra, I at times see these kind of messages popping up in my console: 在使用Cassandra的C / C ++驱动程序时,我有时会在控制台中看到这些消息:

1460937092.140 [WARN] (src/response.cpp:51:char*
      cass::Response::decode_warnings(char*, size_t)):
      Server-side warning: Aggregation query used without partition key

Wondering whether someone knows what that means. 想知道是否有人知道这意味着什么。 What should I be looking for in my code that could generate this error, or is it just something on the server side that I have no control over? 我应该在我的代码中寻找可能产生此错误的内容,或者它只是服务器端的一些我无法控制的东西?

That warning is telling you that you are doing a select using a user defined aggregate without a partition key. 该警告告诉您使用没有分区键的用户定义聚合进行选择。 That may be one that is built in like avg, count, min, max or could've one of your own. 这可能是像avg,count,min,max一样内置的,也可能是你自己的一个。

An example: 一个例子:

select avg(temperature) from weather_data;

Vs VS

select avg(temperature) from weather_data where id = 1;

The first example would scan all rows of data in the cluster and could be a serious performance hit. 第一个示例将扫描群集中的所有数据行,可能会严重影响性能。 If there are enough rows, the query could time out. 如果有足够的行,查询可能会超时。

The second will only scan a single partition of data which keeps the query to one server and is the recommended usage. 第二个只扫描单个数据分区,它将查询保留在一个服务器上,是推荐的用法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM