forum application data model conversion

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

forum application data model conversion

graild
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.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: forum application data model conversion

graild
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.

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.



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: forum application data model conversion

Jonathan Ellis-3
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
Loading...