Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

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?

like image 885
Alexis Wilke Avatar asked Apr 17 '16 23:04

Alexis Wilke


1 Answers

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.

An example:

select avg(temperature) from weather_data;

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.

like image 100
Patrick McFadin Avatar answered Oct 18 '22 11:10

Patrick McFadin