Cassandra 4.0 using java driver for multiple select

Viewed 103

Trying to to send multiple select in a single batch fails with error message:

Invalid statement in batch: only UPDATE, INSERT and DELETE statements are allowed.

What is the best way to send multiple distinct queries (e.g id=x, id=y, id=z).

1 Answers

You can't do this for selects, and it's really doesn't make sense imho. Send each query as a separate requests & collect results.

If the where condition is “the same”, you can use IN operator, although it may increase load onto coordinator. Like, where id IN (x, y, z)

Related