DataStax Academy FAQ

DataStax Academy migrated to a new learning management system (LMS) in July 2020. We are also moving to a new Cassandra Certification process so there are changes to exam bookings, voucher system and issuing of certificates.

Check out the Academy FAQ pages for answers to your questions:


question

sushantgaikwad151193_193943 avatar image
sushantgaikwad151193_193943 asked ·

Does the driver modify queries so columns are converted to asterisk in slow query logs?

I'm using cassandra-driver with NodeJS application.. Table with two columns with one of them as primary key. Through application, Select columnA FROM table_name WHERE columnB="" is executed. Have configuration for Slow queries set... When the above query took more time than threshold... it is printing SELECT * FROM table_name WHERE columnB="__" instead. Is driver modifies query?? How the column name is coverted to asterisk (*)

slow query logging
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

No, the driver does not modify the queries. The logging of the slow queries is what makes it look like the queries are different. Let me explain.

If a query is detected to be slow, the following entry will be logged in the system.log at INFO level (at most once every 5 minutes) by MonitoringTask.java:

INFO  [ScheduledTasks:1] 2020-06-06 20:35:50,209 NoSpamLogger.java:91 - Some operations were slow, details available at debug level (debug.log)

The slow queries are logged in the debug.log every 5 seconds:

DEBUG [ScheduledTasks:1] 2020-06-06 20:35:50,211 MonitoringTask.java:173 - 3 operations were slow in the last 4998 msecs:
<SELECT * FROM community.users LIMIT 5000>, time 3026 msec - slow timeout 500 msec
<SELECT * FROM community.users WHERE user = "jack" LIMIT 5000>, was slow 2 times: avg/min/max 330/825/835 msec - slow timeout 500 msec
<SELECT * FROM community.users WHERE token(id) > 0 LIMIT 5000>, time 1449 msec - slow timeout 500 msec

The implication is that slow queries are not immediately logged -- they are aggregated (counted) for a period of time (5 seconds in this example).

For troubleshooting purposes, the exact CQL string isn't logged. Just the operation ( SELECT, INSERT), the respective table, the filter (WHERE clause) and limits (default is 5000). In most cases, this is sufficient to pinpoint problematic tables and partitions accessed by the application. Cheers!

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

@Erick Ramirez, Thank you for the explanation.

0 Likes 0 · ·
Erick Ramirez avatar image Erick Ramirez ♦♦ sushantgaikwad151193_193943 ·

Glad to help. Cheers!

0 Likes 0 · ·