Prateek Sharma
Prateek Sharma

Reputation: 21

Java driver adding LIMIT and ALLOW FILTERING clauses

While doing the performance test on some of the API using the Cassandra, Java Cassandra driver is implicitly adding the LIMIT and ALLOW FILTERING in query and query in turn is getting timeout.

Query is simple SELECT col1,col2 FROM TABLE WHERE PARTITION_KEY_COL1 = 'AAAA' AND PARTITION_KEY_COL2= 'BBBBB' AND CLUSTERING_KEY_COL1='CCCC'

Cassandra driver version : 4.14.1

Query in trace logs are printed as SELECT col1,col2 FROM TABLE WHERE PARTITION_KEY_COL1 = 'AAAA' AND PARTITION_KEY_COL2= 'BBBBB' AND CLUSTERING_KEY_COL1='CCCC' LIMIT 5000 ALLOW FILTERING.

Not sure why cassandra driver is adding the limit and allow filtering even though i am querying on partition and clustering key and there are no secondary indexes on this table.

PRIMARY KEY of this table is combination of (PARTITION_KEY_COL1 , PARTITION_KEY_COL2)

Not sure about the scenario in which cassandra driver can impicitly adds the limit and allow filtering clause even if we query on combination of partition and clustering key ?

Upvotes: 1

Views: 584

Answers (1)

Erick Ramirez
Erick Ramirez

Reputation: 16353

Those are both benign and not an issue at all.

The LIMIT of 5000 rows is the default for all queries unless you explicitly override it in the driver's configuration. The ALLOW FILTERING does not do anything particularly since the query is restricted to the partition key as you mentioned. Cheers!

Upvotes: 0

Related Questions