O'Reilly logo

Apache Cassandra Essentials by Nitin Padalia

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Tracing Cassandra queries

Cassandra allows us to trace a query session; this can be used to debug queries that perform badly. On the cqlsh prompt, you can enable tracing using the command TRACING ON. After that, each query run on the prompt will be traced, and the trace output will be displayed.

Cassandra automatically saves a traced session in the system_traces keyspace. A saved session can be referenced later on for up to 24 hours.

Take the example of tracing an INSERT statement. Let's first create a column family with replication factor 1, as shown in the following example. We're taking a low replication factor for the simplicity of the example. In our example, 10.78.171.11 is the coordinator node and 10.78.171.12 is the replica node:

cqlsh> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required