Thanks a lot.

I have started with the videos too..I will get back if I see any problem.

Best Regards,
Sandeep Kalra


On Tue, Mar 1, 2016 at 12:36 PM, Jonathan Haddad <j...@jonhaddad.com> wrote:

> I'd do something like this:
>
> CREATE TABLE questions (
>     question_id timeuuid primary key,
>     question text
> );
>
> CREATE TABLE answers (
>     question_id timeuuid,
>     answer_id timeuuid,
>     answer text,
>     primary key(question_id, answer_id)
> );
>
> CREATE TABLE comments (
>     answer_id timeuuid,
>     comment_id timeuuid,
>     comment text,
>     primary key(question_id, answer_id)
> );
>
> You can select all the answers for a given question (ordered by the time
> they appeared, yay) with :
> SELECT * from answers where question_id = ?
>
> Same applies to comments.
>
> If you want to do categories as well, you'd want to modify the question
> table to have category_id as the partition key.  Again, I suggest you watch
> the videos in Datastax Academy and not try to shortcut your data modeling
> knowledge as it's really, really important and screwing it up will cost you
> 100x the time as well as about a million headaches.
>
> On Tue, Mar 1, 2016 at 9:59 AM Sandeep Kalra <sandeep.ka...@gmail.com>
> wrote:
>
>> ​I do not have limit of number of Answers or its comments.​ Assume it to
>> be clone of StackOverflow..
>>
>>
>>
>> Best Regards,
>> Sandeep Kalra
>>
>>
>> On Tue, Mar 1, 2016 at 11:29 AM, Jack Krupansky <jack.krupan...@gmail.com
>> > wrote:
>>
>>> Clustering columns are your friends.
>>>
>>> But the first question is how you need to query the data. Queries drive
>>> data models in Cassandra.
>>>
>>> What is the cardinality of this data - how many answers per question and
>>> how many comments per answer?
>>>
>>>
>>> -- Jack Krupansky
>>>
>>> On Tue, Mar 1, 2016 at 12:23 PM, Sandeep Kalra <sandeep.ka...@gmail.com>
>>> wrote:
>>>
>>>> Hi all.
>>>>
>>>> I am beginner in Cassandra.
>>>>
>>>> I am working on Q&A project where I have to maintain a list of list for
>>>> objects.
>>>>
>>>> For e.g. A Question can have list of Answers, and each Answer can then
>>>> have list of Comments.
>>>>
>>>> --
>>>> As of now I have 3 tables. Questions, Answers, and Comments. I have
>>>> stored UID of Answers in List<uid of answers> for question, and then each
>>>> answer has List<UID of comments> in separate table. [Optionally a Comment
>>>> may have replies]
>>>>
>>>> I do multiple queries to find the complete answers-list and then its
>>>> related comments.
>>>>
>>>> This whole thing looks inefficient to me.
>>>> --
>>>>
>>>> Question:
>>>> *Is there a better way to do it in Cassandra*. What can I do as far as
>>>> re-designing database to have lesser queries.
>>>>
>>>>
>>>>
>>>> Best Regards,
>>>> Sandeep Kalra
>>>>
>>>>
>>>
>>

Reply via email to