6

How can I get an execution plan (or smth like that) for a CQL query? I failed to find any consolidated document about CQL query optimization/execution.

For instance I want to find out, is there any difference in execution of queries like:

select some_column from SOME_TABLE where 
pkField='val1' 
and timestampField='date' 
allow filtering;

and

select some_column from SOME_TABLE where 
pkField='val1' 
and timestampField<='date' 
and timestampField>='date' 
allow filtering;
nukie
  • 691
  • 7
  • 14

1 Answers1

9

Cassandra does not use sophisticated query optimizers as most traditional RDBMS do. Index usage is much more deterministic due to missing relationships between tables.

When it comes to execution, rows are distributed accross individual nodes and possibly multiple sstables within nodes. The actual read path will be different over time for the same query.

To get more details about query execution use TRACING ON; in your cqlsh.

Stefan Podkowinski
  • 5,206
  • 1
  • 20
  • 25
  • thank you for answer, Stefan unfortunately, tracing not helping in this case: it shows mem/sstables access on cluster nodes and stuff, but tells nothing on rows filtering... – nukie Feb 24 '15 at 18:50
  • @nukie, your comment wasn't or isn't valid anymore. https://www.datastax.com/dev/blog/tracing-in-cassandra-1-2, go down and you'll see scaning info, filtered rows, filters used. – Sachin Verma Nov 08 '17 at 12:23