首页 > 解决方案 > 保存 cassandra 复合主键的更新

问题描述

我有一个复合主键(uid,陈旧),当我尝试编辑陈旧的布尔值时,它会被重复(因为复合键可以支持这两种组合)

例如:

1) uid-val, TRUE

当陈旧的列更新为 FALSE 导致 2 行数据具有旧的 TRUE 和新的 FALSE

1) uid-val, TRUE 
2) uid-val, FALSE

在插入更新的值之前有没有办法克服这个问题而不是删除?

标签: cassandraprimary-key

解决方案


No - change of the components of the primary key will lead to adding the new row...

Why not convert that column into "normal" column from partition key/clustering column? I think that you need adjust data model


推荐阅读