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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:32:20+00:00 2026-06-11T00:32:20+00:00

So to set this up, I have a company in which we have users

  • 0

So to set this up, I have a company in which we have users and a set of tags to describe these users.
Each user can have up to 5000 tags attached.

We have an engine that allows clients to pick certain tags to make a tag group. The engine has AND/Or functionality and Include/Exclude. Clients can create a tag group and our engine finds the total number of users that meet the logical requirements specified in the tag group. Basically this is just intersections, unions, and excludes so redis sets have been perfect.

To handle this, I store the data as such.
Tag1:[user1, user2,user3]
Tag2:[user1, user5, user6]
etc

From here, all of the bool logic is done using scripts.

However our customer base is expanding rapidly. Within a couple years, we will either need several 64GB redis servers or an alternative.

Here is my question. Are there any lightning fast DB options for doing intersect and union that are disk based? I have tried Postgres, but the performance is unacceptable. For example, a set compare on a 500k user set takes 1 second. In Postgres, I was seeing around 30 seconds, more if there are lots of tags in the tag group.

I have had DynamoDB recommended and a few others but just wanted some educated opinions before I dig too deep.

Thanks,
Dan

  • 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-11T00:32:22+00:00Added an answer on June 11, 2026 at 12:32 am

    Redis is the best way to get fast intersections and unions. You can do a few things to limit the memory used by Redis :

    Use IntSets

    Internally, Redis uses a data structure IntSets. This is a sorted array of integers. To find an integer in this set, the complexity is O(log N). An IntSet comes in three flavours – 16 bit, 32 bit and 64 bit.

    From a memory perspective, Int Sets are very optimal. If you are using sets and care about memory, you should make sure you are using Int Sets.

    To take advantage of Int Sets, you need to do two things –

    1. Make sure the sets contain integers. If your user ids are strings, you will have to change your logic a bit to make them integers.
    2. In redis.conf, update the setting set-max-intset-entries to a reasonable number. This would be the maximum number of users for a given tag. Note that increasing it beyond a point can actually degrade performance..

    Move User objects to another store

    The sets only need user ids, they don’t need the entire user object. So, if memory becomes a constraint, you can also move User objects to another data store. Perhaps another Redis server, or even a relational database. This approach gives you best of both worlds.

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

Sidebar

Related Questions

I have a user who is part of a company, this company can have
I have two types of 'owner', each of which can have one 'preference'. This
I currently have this set up and working fine inside a users folder. RewriteEngine
I have this set of code which was working fine about an hour or
I have this script set up that echoes all relevant users in a database
My company is working with 3 partners and each partner can have multiple brands.
I have this set of labels and radio buttons that look like this: Entertainment:
let's say I have this set of HTML-markup and CSS #CSS .inputhelp_text { background:
The default in Ruby on Rails is to have this set to false (in
I have this query: UPDATE `terms` SET id = '15', taxonomy_id = '1', parent_id

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.