-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Count command optimization #809
Comments
Pretty sure you can still push down “count” with a LIMIT specified. No reason to return back the keys if they are not needed. |
@JeremiahDJordan If I remember correctly, EDIT Maybe I misunderstood command: LIMIT would of course work for actual query, if used as work-around. |
Is this same as #793 ? |
I read this ticket as a “quick fix” and #793 as “see if there is something else to be done that still gives an approximate count” |
@tatu-at-datastax looks like you are correct. It used to work the way I said in 2.1.x and earlier. But it was “fixed” in 2.2 and later per https://issues.apache.org/jira/plugins/servlet/mobile#issue/CASSANDRA-8216 |
Count command in the API uses cassandra's count function. Cassandra coordinator fetches all the filtered rows from storage and increments the counter for each valid rows. Because of this approach, counting cassandra table with large number of rows potentially takes longer time and eventually starts timing out.
Below is the proposed change for count operation in json api.
limit
<configured limit + 1>more_data
to true. Else return the count of keys retrieved.Translated CQL for count command will look as:
select key from table where filters limit configured limit +1
The text was updated successfully, but these errors were encountered: