How do secondary indexes work in Cassandra?

select * from update_audit where scopeid=35 and formid=78005 and record_link_id=9897; How the above query will work internally in cassandra? Essentially, all data for partition scopeid=35 and formid=78005 will be returned, and then filtered by the record_link_id index. It will look for the record_link_id entry for 9897, and attempt to match-up entries that match the rows … Read more

Does an UPDATE become an implied INSERT

Yes, for Cassandra UPDATE is synonymous with INSERT, as explained in the CQL documentation where it says the following about UPDATE: Note that unlike in SQL, UPDATE does not check the prior existence of the row: the row is created if none existed before, and updated otherwise. Furthermore, there is no mean to know which … Read more

How to create auto increment IDs in Cassandra

How about the following, using Cassandra’s Lightweight transactions 1 – Create IDs table: CREATE TABLE ids ( id_name varchar, next_id int, PRIMARY KEY (id_name) ) 2 – Insert every id you’d like to use a global sequence with For example: INSERT INTO ids (id_name, next_id) VALUES (‘person_id’, 1) 3 – Then, when inserting to a … Read more

Cassandra server throws java.lang.AssertionError: DecoratedKey(…) != DecoratedKey

This is either https://issues.apache.org/jira/browse/CASSANDRA-4687 or https://issues.apache.org/jira/browse/CASSANDRA-5202 You can run the command “nodetool invalidatekeycache” on all of the server showing the error. If it keeps coming back you may want to disable key cache. If it is 5202 it should only happen after dropping and recreating a column family using the same name.