Storing items in a map or in rows in Cassandra
<p>I need to store users lists by customer in cassandra. There are two basic approaches I see:</p>

<pre><code>A: create table users (  // one row per user
     customer int, userId int, primary key (customer, userId),
     login text, name text, email text
   );
</code></pre>

<p>or</p>

<pre><code>B: create table users (  // one row per customer
     customer int primary key, users map&lt;int, text&gt;
   );
</code></pre>

<p>where in the second approach I would store a JSON representation of the user data as "text".</p>

<p>I will have the following operations on the table:</p>

<ul>
<li>insert / update / delete single user</li>
<li>read all users for a customer</li>
<li>read a single user by id and customer</li>
</ul>

<p>Here are the questions:</p>

<p>1) For large users lists, B is a bad idea. What order of magnitude would "large" be?</p>

<p>2) Would you expect B to have better performance for small users lists? What order of magnitude would "small" be?</p>

<p>3) What other advantages / disadvantages do you see for A or B?</p>

<p>(For those who need to know: I'm using scala / datastax driver / phantom to access the database.)</p>