Coder
Coder

Reputation: 3262

Cassandra query logs and performance

1) Is there a way to log the queries executed in Cassandra?
2) For performance, I understand TracingON in cqlsh is a good feature for tracing the single query we execute in cqlsh. But Is there a way to profile the Cassandra queries which gives the execution time, query data size etc.,

Upvotes: 1

Views: 752

Answers (1)

dilsingi
dilsingi

Reputation: 2958

Tracing isn't just limited to CQL. You could enable the same behavior from Java code as well.

Set the tracing flag on the Statement instance. There are various ways depending on how you build it:

// Setter-based:
Statement statement =
  SimpleStatement.newInstance("SELECT * FROM users WHERE id = 1234").setTracing(true);

// Builder-based:
Statement statement =
  SimpleStatement.builder("SELECT * FROM users WHERE id = 1234").withTracing().build();

Here is the detailed reference

Upvotes: 2

Related Questions