Hung Le
Hung Le

Reputation: 15

cassandra batch increment counter?

I have a phone table, with phone number is the key, and 4 columns (total, call, sms, received, ...). Each time a call is made, then I need to increment total, and call, ... Same thing for sms. Right now I update the row by incrementing total, then incrementing call/sms. I just wonder if there is a batch increment, so I can update them all at once? All the counters (total, call, sms, received, ...) need to be accurate, I may have 2 events coming into same phone in 0.5 second. I used "increment counter" in order to have accurate counters.

Upvotes: 0

Views: 867

Answers (1)

lstern
lstern

Reputation: 1629

Yes, you can use batch_mutate to update multiple columns at once. Beware that batch_mutate is not atomic, so, if some column update fails, no rollback is issued.

Upvotes: 1

Related Questions