cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Perroud <ben...@noisette.ch>
Subject Fewer wide rows vs. more smaller rows
Date Thu, 04 Aug 2011 07:38:45 GMT
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.

Mime
View raw message