incubator-cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonathan Ellis <jbel...@gmail.com>
Subject Re: Fewer wide rows vs. more smaller rows
Date Thu, 04 Aug 2011 16:24:36 GMT
The principle is, "keep data you retrieve at the same time, in the same row."

Here the logical unit to query is one user so I don't see any benefit
to forcing them into a single row "unnaturally."

On Thu, Aug 4, 2011 at 2:38 AM, Benoit Perroud <benoit@noisette.ch> wrote:
> Hi All,
>
> In a conceptual point of view, I'm wondering what is the pros & cons,
> mainly in term of access efficiency, of both approach :
>
> - Grouping row keys together to reduce the number of keys, but having
> wider rows (with more columns)
> - One object in one row
>
> Let's illustrate with an example :
>
> I want to store objects like : User { email, firstname, lastname, ...
> }, with a key hash(email).
>
> Given the two following users :
>
> User1 { "email1", "firstname1", "lastname1", ... }, hash("email1") = "abcdefgh"
> User1 { "email2", "firstname2", "lastname2", ... }, hash("email2") = "abcdabcd"
>
> I can either store
>
> UserCF["abcdefgh"] = { email = "email1", firstname = "firstname1",
> lastname = "lastname1" }
> UserCF["abcdabcd"] = { email = "email2", firstname = "firstname2",
> lastname = "lastname2" }
>
> or do something like (for example using composites) :
>
> UserCF["abcd"] = { ("abcd", email) = "email2", ("abcd", firstname) =
> "firstname2", ("abcd", lastname) = "lastname2", ("efgh", email) =
> "email1", ("efgh", firstname) = "firstname1", ("efgh", lastname) =
> "lastname1" }
>
> Thanks in advance for your advises.
>



-- 
Jonathan Ellis
Project Chair, Apache Cassandra
co-founder of DataStax, the source for professional Cassandra support
http://www.datastax.com

Mime
View raw message