简体   繁体   中英

Cassandra read before write/update

What is the fastest way to read before write? I've a Import script that's load about 10-15K emails and I need to check if they exists or not, Is there a way to write and see if it's overwrite other data? Or I just need to do read before write?

Thanks.

If you don't care to overwrite an email then you dont need any reads as insert and update are synonyms. If you do then you can use lightweight transactions ( INSERT ... IF NOT EXISTS ). If a record with a given key exists then it will not be overwritten. You can add a column to the table where an application will pass a unique value. Once you insert data you call SELECT and compare the value of that column with the value that was passed. If they match then this record was created by your call. If not then it was created by some other process

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM