是否可以在Cassandra中创建唯一的二级索引? [英] Is it possible to create unique secondary index in Cassandra?

查看:173
本文介绍了是否可以在Cassandra中创建唯一的二级索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从我阅读的内容中,我看不到任何指定唯一性约束的选项。我想知道是否有可能?将列更改为主键也将需要更改其他一些表。这就是为什么我问是否有可能具有唯一的二级索引?

From what I read, I could not see any option of specifying the uniqueness constraint. I wanted to know whether it is possible ? Changing the column to primary key will require changing some other tables as well. That is why I am asking if it is possible to have a unique secondary index ?

推荐答案

物化视图功能旨在解决此问题。您可以在唯一的辅助列上创建一个物化视图,以便随后可以将该列作为主键来查询该视图。

The materialized views feature in Cassandra 3.0 is meant to help with this problem. You can create a materialized view on a secondary column that is unique such that you can then query the view with that column as the primary key.

有一些限制,因为Cassandra必须在为您提供引擎盖,以使物化视图保持最新状态。

There are some limitations with using this feature, as Cassandra has to do a lot of book keeping under the hood for you in order to keep the materialized view up to date.

这篇关于是否可以在Cassandra中创建唯一的二级索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆