Reputation: 1074
Is there a maximum length limitation the cql query string?
I am planning to execute a long query of this form: select * from table where key in ('abc', 'xyz', ...)
and I am estimating the length of the query string to be about 60kB in worst cases.
Upvotes: 4
Views: 2283
Reputation: 1566
In testing, I was able to get to a query length of about 90K before the system started throwing errors.
Depending on how you're doing your reads, you may run into an error of "Argument list too long" way before you get to 65535 items in your list. I was able to reproduce this with a list of just 5000 (using a list of IDs created via cat /proc/sys/kernel/random/uuid
).
Upvotes: 3
Reputation: 87164
Per documentation, you have a limit on a number of parameters in query (65535), but not the string length.
But you need carefully consider your approach - have a few values in the IN
is ok, but having too many of them will lead to troubles because the node that receives your request ("coordinator") will need to forward queries to all nodes that have data for your keys, wait for results, collect everything into one piece, and send back. Most probable, this will lead to overload of the coordinator node, and either crashing, or time outing, or something else.
If you issue your requests in parallel, by using the asynchronous API, then you can get better performance comparing to using IN
.
Upvotes: 4