|
Converting a Forum application to cassandra's data model.
Tables: Posts [postID, threadID, userID, subject, body, created, lastmodified] So this table contains the actual question subject and body. When a user logs in, they want to see a list of their questions, and also order by the last-modified date (to see if people responed to their question). How would you do this best in Cassandra, seeing as the question/answer text is stored in another table. I know you could make a CF like: userID { postID1, postID2, ...} And somehow order by last-modified, but then on the actual web page you would have to first query for postID's owned by the user, and orderd by last-modified. THEN you would have to fetch the post data from the posts collection. Is this the only way? I mean other than repeating the post subject+body in the user-to-postID index CF. |
|
Any thoughts?
On Tue, Jun 22, 2010 at 2:13 PM, S Ahmed <[hidden email]> wrote: Converting a Forum application to cassandra's data model. |
|
In reply to this post by graild
The principle in Cassandra modeling is that for each query, you should
denormalize your data at write time such that you can get the data for that query from a single row. The best explanation so far is at http://www.rackspacecloud.com/blog/2010/05/12/cassandra-by-example/ On Tue, Jun 22, 2010 at 1:13 PM, S Ahmed <[hidden email]> wrote: > Converting a Forum application to cassandra's data model. > > Tables: > > Posts [postID, threadID, userID, subject, body, created, lastmodified] > > So this table contains the actual question subject and body. > > When a user logs in, they want to see a list of their questions, and also > order by the last-modified date (to see if people responed to their > question). > > How would you do this best in Cassandra, seeing as the question/answer text > is stored in another table. > > I know you could make a CF like: > > userID { postID1, postID2, ...} > > And somehow order by last-modified, but then on the actual web page you > would have to first query for postID's owned by the user, and orderd by > last-modified. > > THEN you would have to fetch the post data from the posts collection. > > Is this the only way? I mean other than repeating the post subject+body in > the user-to-postID index CF. > > > -- Jonathan Ellis Project Chair, Apache Cassandra co-founder of Riptano, the source for professional Cassandra support http://riptano.com |
| Powered by Nabble | See how NAML generates this page |
