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

lavaraja.padala_150810 avatar image
lavaraja.padala_150810 asked ·

What is the time unit for events and sessions tables in Apache Cassandra?

We wanted to capture the long running queries in Apache Cassandra cluster. What is the unit for duration and source_elapsed in sessions and events tables. Is it milliseconds or microseconds?

CREATE TABLE system_traces.sessions (
    ...    duration int,
    ...
)
CREATE TABLE system_traces.events (
    ...
    source_elapsed int,
    ...
)

Regards,

Lavaraja.

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 ·

Both duration and source_elapsed are in microseconds.

Here is a sample trace output in cqlsh:

Tracing session: 12009cc0-d588-11ea-ac98-437845cca09f

 activity                                         | timestamp                  | source   | source_elapsed | client
--------------------------------------------------+----------------------------+----------+----------------+----------
                               Execute CQL3 query | 2020-08-03 22:51:38.264000 | 10.x.x.x |              0 | 10.x.x.x
         Parsing INSERT INTO ... ; [CoreThread-0] | 2020-08-03 22:51:38.268000 | 10.x.x.x |           6551 | 10.x.x.x
               Preparing statement [CoreThread-0] | 2020-08-03 22:51:38.270000 | 10.x.x.x |           8461 | 10.x.x.x
 Determining replicas for mutation [CoreThread-0] | 2020-08-03 22:51:38.273000 | 10.x.x.x |          10746 | 10.x.x.x
            Appending to commitlog [CoreThread-0] | 2020-08-03 22:51:38.274000 | 10.x.x.x |          11611 | 10.x.x.x
    Adding to message_map memtable [CoreThread-0] | 2020-08-03 22:51:38.274000 | 10.x.x.x |          11840 | 10.x.x.x
                                 Request complete | 2020-08-03 22:51:38.283161 | 10.x.x.x |          19161 | 10.x.x.x

These are the same entries in the system_traces.events table. The source_elapsed value of 19161 is equivalent to 19 milliseconds.

This is the same value as duration in the system_traces.sessions table:

SELECT session_id, duration FROM system_traces.sessions ;

 session_id                           | duration
--------------------------------------+----------
 12009cc0-d588-11ea-ac98-437845cca09f |    19161

Cheers!

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.