Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rustyrazorblade/c4947fc37da85bca50e08aa1ef3c7a06 to your computer and use it in GitHub Desktop.
Save rustyrazorblade/c4947fc37da85bca50e08aa1ef3c7a06 to your computer and use it in GitHub Desktop.
cassandra 3.10 filtering
jhaddad@rustyrazorblade ~$ ccm node1 cqlsh
Connected to 3.10 at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 3.10 | CQL spec 3.4.4 | Native protocol v4]
Use HELP for help.
cqlsh> create KEYSPACE test WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
cqlsh> use test;
cqlsh:test> create table
...
cqlsh:test>
cqlsh:test> create table hello(
... a text,
... b int,
... c text,
... d text,
... primary key((a,b), c)
... );
cqlsh:test>
cqlsh:test> insert into hello (a, b, c, d) values ('jon', 1, 'a', 'd');
cqlsh:test> insert into hello (a, b, c, d) values ('dave', 1, 'a', 'd');
cqlsh:test> insert into hello (a, b, c, d) values ('mike', 1, 'a', 'd');
cqlsh:test> insert into hello (a, b, c, d) values ('dave', 2, 'a', 'd');
cqlsh:test> insert into hello (a, b, c, d) values ('dave', 3, 'a', 'd');
cqlsh:test> insert into hello (a, b, c, d) values ('dave', 5, 'a', 'd');
cqlsh:test> insert into hello (a, b, c, d) values ('dave', 5, 'b', 'd');
cqlsh:test> select * from hello where a = 'dave';
InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING"
cqlsh:test> select * from hello where a = 'dave' allow filtering;
a | b | c | d
------+---+---+---
dave | 5 | a | d
dave | 5 | b | d
dave | 1 | a | d
dave | 2 | a | d
dave | 3 | a | d
(5 rows)
cqlsh:test> tracing on;
Now Tracing is enabled
cqlsh:test> select * from hello where a = 'dave' allow filtering;
a | b | c | d
------+---+---+---
dave | 5 | a | d
dave | 5 | b | d
dave | 1 | a | d
dave | 2 | a | d
dave | 3 | a | d
(5 rows)
Tracing session: 6943d650-34c3-11e7-bd04-8534d2cb15cb
activity | timestamp | source | source_elapsed | client
---------------------------------------------------------------------------------------------------------------------------+----------------------------+-----------+----------------+-----------
Execute CQL3 query | 2017-05-09 09:25:54.743000 | 127.0.0.1 | 0 | 127.0.0.1
Parsing select * from hello where a = 'dave' allow filtering; [Native-Transport-Requests-1] | 2017-05-09 09:25:54.746000 | 127.0.0.1 | 3045 | 127.0.0.1
Preparing statement [Native-Transport-Requests-1] | 2017-05-09 09:25:54.746000 | 127.0.0.1 | 3470 | 127.0.0.1
Computing ranges to query [Native-Transport-Requests-1] | 2017-05-09 09:25:54.746000 | 127.0.0.1 | 3882 | 127.0.0.1
Submitting range requests on 3 ranges with a concurrency of 1 (0.0 rows per range expected) [Native-Transport-Requests-1] | 2017-05-09 09:25:54.747000 | 127.0.0.1 | 4101 | 127.0.0.1
Enqueuing request to /127.0.0.2 [Native-Transport-Requests-1] | 2017-05-09 09:25:54.747000 | 127.0.0.1 | 4375 | 127.0.0.1
Submitted 1 concurrent range requests [Native-Transport-Requests-1] | 2017-05-09 09:25:54.747000 | 127.0.0.1 | 4649 | 127.0.0.1
Sending RANGE_SLICE message to /127.0.0.2 [MessagingService-Outgoing-/127.0.0.2-Small] | 2017-05-09 09:25:54.747000 | 127.0.0.1 | 4832 | 127.0.0.1
RANGE_SLICE message received from /127.0.0.1 [MessagingService-Incoming-/127.0.0.2] | 2017-05-09 09:25:54.750000 | 127.0.0.2 | 642 | 127.0.0.1
Executing seq scan across 0 sstables for (min(-9223372036854775808), max(-3074457345618258603)] [ReadStage-1] | 2017-05-09 09:25:54.751000 | 127.0.0.2 | 1972 | 127.0.0.1
Read 3 live and 0 tombstone cells [ReadStage-1] | 2017-05-09 09:25:54.752000 | 127.0.0.2 | 2461 | 127.0.0.1
Enqueuing response to /127.0.0.1 [ReadStage-1] | 2017-05-09 09:25:54.752000 | 127.0.0.2 | 2623 | 127.0.0.1
Sending REQUEST_RESPONSE message to /127.0.0.1 [MessagingService-Outgoing-/127.0.0.1-Small] | 2017-05-09 09:25:54.752000 | 127.0.0.2 | 2909 | 127.0.0.1
REQUEST_RESPONSE message received from /127.0.0.2 [MessagingService-Incoming-/127.0.0.1] | 2017-05-09 09:25:54.753000 | 127.0.0.1 | 10283 | 127.0.0.1
Processing response from /127.0.0.2 [RequestResponseStage-2] | 2017-05-09 09:25:54.753000 | 127.0.0.1 | 10511 | 127.0.0.1
Enqueuing request to /127.0.0.3 [Native-Transport-Requests-1] | 2017-05-09 09:25:54.754000 | 127.0.0.1 | 11098 | 127.0.0.1
Submitted 2 concurrent range requests [Native-Transport-Requests-1] | 2017-05-09 09:25:54.754000 | 127.0.0.1 | 11253 | 127.0.0.1
Sending RANGE_SLICE message to /127.0.0.3 [MessagingService-Outgoing-/127.0.0.3-Small] | 2017-05-09 09:25:54.754000 | 127.0.0.1 | 11412 | 127.0.0.1
Executing seq scan across 0 sstables for (max(3074457345618258602), min(-9223372036854775808)] [ReadStage-3] | 2017-05-09 09:25:54.754000 | 127.0.0.1 | 11681 | 127.0.0.1
Read 2 live and 0 tombstone cells [ReadStage-3] | 2017-05-09 09:25:54.754000 | 127.0.0.1 | 11975 | 127.0.0.1
RANGE_SLICE message received from /127.0.0.1 [MessagingService-Incoming-/127.0.0.3] | 2017-05-09 09:25:54.757000 | 127.0.0.3 | 538 | 127.0.0.1
Executing seq scan across 0 sstables for (max(-3074457345618258603), max(3074457345618258602)] [ReadStage-5] | 2017-05-09 09:25:54.761000 | 127.0.0.3 | 4635 | 127.0.0.1
Read 2 live and 0 tombstone cells [ReadStage-5] | 2017-05-09 09:25:54.762000 | 127.0.0.3 | 5092 | 127.0.0.1
Enqueuing response to /127.0.0.1 [ReadStage-5] | 2017-05-09 09:25:54.762000 | 127.0.0.3 | 5216 | 127.0.0.1
Sending REQUEST_RESPONSE message to /127.0.0.1 [MessagingService-Outgoing-/127.0.0.1-Small] | 2017-05-09 09:25:54.762000 | 127.0.0.3 | 5506 | 127.0.0.1
REQUEST_RESPONSE message received from /127.0.0.3 [MessagingService-Incoming-/127.0.0.1] | 2017-05-09 09:25:54.763000 | 127.0.0.1 | 20289 | 127.0.0.1
Processing response from /127.0.0.3 [RequestResponseStage-7] | 2017-05-09 09:25:54.766000 | 127.0.0.1 | 23141 | 127.0.0.1
Request complete | 2017-05-09 09:25:54.766704 | 127.0.0.1 | 23704 | 127.0.0.1
cqlsh:test> tracing off;
Disabled Tracing.
cqlsh:test> select max(b) from hello where a = 'dave' allow filtering;
system.max(b)
---------------
5
(1 rows)
cqlsh:test> tracing on;
Now Tracing is enabled
cqlsh:test> select max(b) from hello where a = 'dave' allow filtering;
system.max(b)
---------------
5
(1 rows)
Tracing session: 9d02c140-34c3-11e7-bd04-8534d2cb15cb
activity | timestamp | source | source_elapsed | client
---------------------------------------------------------------------------------------------------------------------------+----------------------------+-----------+----------------+-----------
Execute CQL3 query | 2017-05-09 09:27:21.556000 | 127.0.0.1 | 0 | 127.0.0.1
Parsing select max(b) from hello where a = 'dave' allow filtering; [Native-Transport-Requests-1] | 2017-05-09 09:27:21.556000 | 127.0.0.1 | 387 | 127.0.0.1
Preparing statement [Native-Transport-Requests-1] | 2017-05-09 09:27:21.556000 | 127.0.0.1 | 683 | 127.0.0.1
Computing ranges to query [Native-Transport-Requests-1] | 2017-05-09 09:27:21.557000 | 127.0.0.1 | 1269 | 127.0.0.1
Submitting range requests on 3 ranges with a concurrency of 1 (0.0 rows per range expected) [Native-Transport-Requests-1] | 2017-05-09 09:27:21.557000 | 127.0.0.1 | 1460 | 127.0.0.1
Enqueuing request to /127.0.0.2 [Native-Transport-Requests-1] | 2017-05-09 09:27:21.557000 | 127.0.0.1 | 1619 | 127.0.0.1
Submitted 1 concurrent range requests [Native-Transport-Requests-1] | 2017-05-09 09:27:21.557000 | 127.0.0.1 | 1787 | 127.0.0.1
Sending RANGE_SLICE message to /127.0.0.2 [MessagingService-Outgoing-/127.0.0.2-Small] | 2017-05-09 09:27:21.557000 | 127.0.0.1 | 1837 | 127.0.0.1
RANGE_SLICE message received from /127.0.0.1 [MessagingService-Incoming-/127.0.0.2] | 2017-05-09 09:27:21.558000 | 127.0.0.2 | 26 | 127.0.0.1
Executing seq scan across 0 sstables for (min(-9223372036854775808), max(-3074457345618258603)] [ReadStage-1] | 2017-05-09 09:27:21.558000 | 127.0.0.2 | 593 | 127.0.0.1
Read 3 live and 0 tombstone cells [ReadStage-1] | 2017-05-09 09:27:21.559000 | 127.0.0.2 | 1110 | 127.0.0.1
Enqueuing response to /127.0.0.1 [ReadStage-1] | 2017-05-09 09:27:21.559000 | 127.0.0.2 | 1264 | 127.0.0.1
Sending REQUEST_RESPONSE message to /127.0.0.1 [MessagingService-Outgoing-/127.0.0.1-Small] | 2017-05-09 09:27:21.559000 | 127.0.0.2 | 1463 | 127.0.0.1
REQUEST_RESPONSE message received from /127.0.0.2 [MessagingService-Incoming-/127.0.0.1] | 2017-05-09 09:27:21.560000 | 127.0.0.1 | 4231 | 127.0.0.1
Processing response from /127.0.0.2 [RequestResponseStage-2] | 2017-05-09 09:27:21.560000 | 127.0.0.1 | 4619 | 127.0.0.1
Enqueuing request to /127.0.0.3 [Native-Transport-Requests-1] | 2017-05-09 09:27:21.561000 | 127.0.0.1 | 5129 | 127.0.0.1
Submitted 2 concurrent range requests [Native-Transport-Requests-1] | 2017-05-09 09:27:21.561000 | 127.0.0.1 | 5336 | 127.0.0.1
Sending RANGE_SLICE message to /127.0.0.3 [MessagingService-Outgoing-/127.0.0.3-Small] | 2017-05-09 09:27:21.561000 | 127.0.0.1 | 5344 | 127.0.0.1
Executing seq scan across 0 sstables for (max(3074457345618258602), min(-9223372036854775808)] [ReadStage-3] | 2017-05-09 09:27:21.561000 | 127.0.0.1 | 5547 | 127.0.0.1
RANGE_SLICE message received from /127.0.0.1 [MessagingService-Incoming-/127.0.0.3] | 2017-05-09 09:27:21.562000 | 127.0.0.3 | 24 | 127.0.0.1
Read 2 live and 0 tombstone cells [ReadStage-3] | 2017-05-09 09:27:21.562000 | 127.0.0.1 | 5895 | 127.0.0.1
Executing seq scan across 0 sstables for (max(-3074457345618258603), max(3074457345618258602)] [ReadStage-1] | 2017-05-09 09:27:21.562000 | 127.0.0.3 | 424 | 127.0.0.1
Read 2 live and 0 tombstone cells [ReadStage-1] | 2017-05-09 09:27:21.562000 | 127.0.0.3 | 802 | 127.0.0.1
Enqueuing response to /127.0.0.1 [ReadStage-1] | 2017-05-09 09:27:21.562001 | 127.0.0.3 | 922 | 127.0.0.1
Sending REQUEST_RESPONSE message to /127.0.0.1 [MessagingService-Outgoing-/127.0.0.1-Small] | 2017-05-09 09:27:21.563000 | 127.0.0.3 | 1245 | 127.0.0.1
REQUEST_RESPONSE message received from /127.0.0.3 [MessagingService-Incoming-/127.0.0.1] | 2017-05-09 09:27:21.563000 | 127.0.0.1 | 7548 | 127.0.0.1
Processing response from /127.0.0.3 [RequestResponseStage-3] | 2017-05-09 09:27:21.563000 | 127.0.0.1 | 7818 | 127.0.0.1
Request complete | 2017-05-09 09:27:21.564477 | 127.0.0.1 | 8477 | 127.0.0.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment