20

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?

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156

1 Answers1

27

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.

Alexis Wilke
  • 19,179
  • 10
  • 84
  • 156
Patrick McFadin
  • 1,341
  • 8
  • 10
  • 1
    Ah. That's the `count(*)`... that worked well with thrift and just returned the number of rows. Or maybe not... But I see the statement causing the warning now. – Alexis Wilke Apr 18 '16 at 08:20