Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra 4.0 using java driver for multiple select

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).

like image 907
Doron Levi Avatar asked Jun 09 '26 16:06

Doron Levi


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)

like image 99
Alex Ott Avatar answered Jun 12 '26 06:06

Alex Ott



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!