cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Rhoden <>
Subject Re: One big table/cf or many small ones?
Date Sat, 14 Dec 2013 04:40:19 GMT
Hi Tinus,

> On 12 Dec 2013, at 6:59 pm, Tinus Sky <> wrote:
> My service does have users who can add a message to a list. The list of message is sorted
by date and displayed. When a user changes the message the date is changed and the message
moves to the top of the list.
> A possible solution is to remove row and insert it again, but i suspect this might be
not the best solution. Is there a alternative solution?

Just insert a new "version" of the message, with a version field into the table/columnfamily.
When outputting query results to the user, filter/hide older versions. And bam you have a
new feature in your web site called "show old versions" or "show previous edits".

> My second question is regarding the number of tables/column families in a keyspace.
> I can create a table which contains all messages from all users. But i can also create
one table for every user which has a name like: messages_[userid], where [userid] is the id
of the user. Or i can shard: messages_a (contains messages from user where name starts with
a), messages_b (contains messages from user where name starts with b)
> My users count is around 100.000. And the messages per user are approx around 20.000.
> What would be the choice: put everything in 1 big table or go with the many small tables

I'm pretty sure you don't want to put 100,000 tables in a Cassandra key space. Go with one.

View raw message