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 7908151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:47:53+00:00 2026-06-03T11:47:53+00:00

I am using a Posts and TaggedPosts column families like shown in this example

  • 0

I am using a Posts and TaggedPosts column families like shown in this example

I would like to be able to find Posts Tagged with tags ‘A’, ‘B’ and ‘C’ (for the example)

the problem is i have to read entirely TaggedPosts with key A, and not just fetch first 10 results as it’s shown in example, then intersect with all TaggedPosts with key B, to not miss one and so on

It’s super inefficient, what would be your advise ion order to do this?

I was thinking to change TaggedPosts structure: and put Posts ids as Rows keys and

create colmun familty TaggedPosts with ... and column_metadata=[
    {column_name: tag1, ..., index_type: KEYS},
    {column_name: tag2, ..., index_type: KEYS},
    {column_name: tag3, ..., index_type: KEYS},

and do:

get TaggedPosts where tag1=A and tag2=B and tag3=C;

but not sure it would be much more effective, than intersecting/filtering client-side

  • 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-06-03T11:48:00+00:00Added an answer on June 3, 2026 at 11:48 am

    I think the ideal schema for your case would depend on how often you need to perform that intersecting query, and whether you need to be able to get quick results for any arbitrary pair of tags, or for any arbitrary set of N tags, or whether you’ll only need to do that with certain, limited tags.

    If, as I suspect, you want to be able to query for posts matching any arbitrary set of tags, there may not be any better solution than to have a schema like this (cql3):

    CREATE COLUMNFAMILY TaggedPosts (
        tag text,
        post uuid,
        blog_rowentries_rowkey text,
        PRIMARY KEY (tag, post)
    ) WITH COMPACT STORAGE;
    
    -- (note that this is the same actual data layout used in the "wtf is a supercolumn" article)
    

    And then query for “posts with A”, “posts with B”, etc. like this:

    SELECT * FROM TaggedPosts WHERE tag = 'A' LIMIT 100;
    SELECT * FROM TaggedPosts WHERE tag = 'B' LIMIT 100;
    

    ..so they’re individually queried, and then you merge the results client-side. The limit there of 100 may not be ideal for your data; the ideal value depends on how likely your tags are to overlap. It’s not intended to guarantee that you get all the results you want, obviously, it’s just a batch size. If you don’t find enough posts matching all tags, you query for more batches from the tags with the lowest uuid-times until you do.

    You could do a lot better than this in terms of efficiency and ease-of-coding with a Solr index, since this is more of a full-text-search kind of a problem, but you’d need Datastax Enterprise or some other way to integrate Solr yourself. (Disclaimer: I work for Datastax.)

    Best advice I can give on the topic, though, is not to use supercolumns.

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

Sidebar

Related Questions

I'm trying to display the latest 5 posts using a generic view like this:
I would like to display the posts the way they are shown when you
When using PHP API posts ' likes comes in this detailed format [likes] =>
I'm currently using: @user = User.find(params[:id]) @posts = Post.find(:all, :conditions => [user_id = ?,
I need a help with this regexp.. using /\{block:(Posts|Photos|Videos)(\s\[.*?\])?\}(\s?[^\]+\s?)\{\/block\}/U i get {block:Posts}abcdef{/block} from this:
I'm trying to select posts using MATCH to find strings that contain the exact
So I have this site that dynamically posts content using jquery and php. I
I am setting up an API. The client (using HTTParty) posts this to the
Hi am using get_posts to grab all posts tagged as 'news' and display them
I read in a few posts that using JUnit to test concurrency is not

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.