Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7070229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:32:30+00:00 2026-05-28T05:32:30+00:00

i want to make a query for two column families at once… I’m using

  • 0

i want to make a query for two column families at once… I’m using the cassandra-cql gem for rails and my column families are:

users
following
followers
user_count
message_count
messages

Now i want to get all messages from the people a user is following. Is there a kind of multiget with cassandra-cql or is there any other possibility by changing the datamodel to get this kind of data?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:32:31+00:00Added an answer on May 28, 2026 at 5:32 am

    I would call your current data model a traditional entity/relational design. This would make sense to use with an SQL database. When you have a relational database you rely on joins to build your views that span multiple entities.

    Cassandra does not have any ability to perform joins. So instead of modeling your data based on your entities and relations, you should model it based on how you intend to query it. For your example of ‘all messages from the people a user is following’ you might have a column family where the rowkey is the userid and the columns are all the messages from the people that user follows (where the column name is a timestamp+userid and the value is the message):

    RowKey                              Columns
    -------------------------------------------------------------------
    |        | TimeStamp0:UserA | TimeStamp1:UserB | TimeStamp2:UserA |
    | UserID |------------------|------------------|------------------|
    |        | Message          | Message          | Message          |
    -------------------------------------------------------------------
    

    You would probably also want a column family with all the messages a specific user has written (I’m assuming that the message is broadcast to all users instead of being addressed to one particular user):

    RowKey                   Columns
    --------------------------------------------------------
    |        | TimeStamp0 | TimeStamp1 | TimeStamp2        |
    | UserID |------------|------------|-------------------|
    |        | Message    | Message    | Message           |
    --------------------------------------------------------
    

    Now when you create a new message you will need to insert it multiple places. But when you need to list all messages from people a user is following you only need to fetch from one row (which is fast).

    Obviously if you support updating or deleting messages you will need to do that everywhere that there is a copy of the message. You will also need to consider what should happen when a user follows or unfollows someone. There are multiple solutions to this problem and your solution will depend on how you want your application to behave.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using mssql and I want to make a query that returns a
I have two tables and want to make a query. I tried to get
I want to make a query to list cats that took longer than average
I have 3 tables, and I want to make a query for a search
I want to make a CAML query semi-smart - in that I can give
I want to make this kind of query: create procedure something @name varchar(13) as
I will make this quick and simple I have a query and I want
I want make datetimepicker in my project. Using jquery how it is possible? I
I want to make a query that will give the result on order by
I want to make a SQL query that gets todays date and the most

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.