Mike Wang
Mike Wang

Reputation: 41

prevent duplicate row in Cassandra

I have a CF, its PK is an UUID, I also have a column like regNum, it's a natural key. I do have an index on regNum.

Currently, whenever I try to insert a new record, I do a query on regNum to make sure there is no duplicate before generating an UUID for insertion.

However, I found out I do have duplicate regNum in this CF. Any idea how to prevent this? Thanks.

Upvotes: 0

Views: 1116

Answers (1)

abhi
abhi

Reputation: 4792

Can you set regNum as your key instead of the UUID. That will solve your problem

Upvotes: 2

Related Questions