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?
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.
select avg(temperature) from weather_data;
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.