Cassandra table with multiple counter columns

I was wondering if it was a good idea (performance wise) to have multiple counters on the same table/columnfamily in Cassandra? My current setup is this:

CREATE TABLE IF NOT EXISTS contentCounters (
downvotes counter,
comments counter,
upvotes counter,
contentid uuid,
PRIMARY KEY (contentid)
);

But I'm not sure whether or not it's ok, in terms of performance, to have multiple counters on the same table. Previously, I had 3 tables with counters (tracking upvote, downvote and comment counts) but I would like to combine them all to the above hierarchy to allow for fast queries to this table to get these values (as that is my use-case).

Any advise would be greatly appreciated.

Many thanks,


I don't think this should be an issue. Cassandra doesn't update "rows" in their entirety. The "row" itself isn't locked during updates, but based on this article for 2.1+, just the counter column in the UPDATE statement identified by the specified partition key.

There is a better counter implementation in 2.1+ than in previous versions. Read more here

链接地址: http://www.djcxy.com/p/22376.html

上一篇: POSTMAN头中的JWT令牌

下一篇: 卡桑德拉表与多个柜台列