How to update clustering key in cassandra using update query?

前端 未结 2 1707
情歌与酒
情歌与酒 2021-01-18 21:33

This is my table structure and I am updating the sequence with the following query:

Update styles set sequence=1 where styleid = \'CLASSIC\';
2条回答
  •  一个人的身影
    2021-01-18 22:19

    Based on how Cassandra stores the data, updating clustering columns (Primary key) is not possible.

    Rowkey which is a combination of **styleid** ->[sequence] -> [active boolean,image ascii, name ascii]

    In order to point non-primary columns for updating/deleting, it needs to parse through styleid -> sequence partition to hit the columns.

    Primary key once created can't be changed as it represents how data is stored in Cassandra. Hence updating 'sequence' here is not possible.

提交回复
热议问题