alter composite primary key in cassandra CQL 3.0

后端 未结 2 418
予麋鹿
予麋鹿 2021-01-01 09:58

I\'m in a situation where I need to change the the composite primary key as follows:

Old Primary Key: (id, source, attribute_name, updated_at);

相关标签:
2条回答
  • 2021-01-01 10:23

    If there is a possibility to use the old primary key, you could create a materialzied view: http://docs.datastax.com/en/cql/3.3/cql/cql_using/useCreateMV.html But it is only recommendable, if you would need the old key.

    0 讨论(0)
  • 2021-01-01 10:45

    There is no way to change a primary key, as it defines how your data is physically stored.

    You can create a new table with the new primary key, copy data from the old one, and then drop the old table.

    0 讨论(0)
提交回复
热议问题