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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:32:18+00:00 2026-05-13T11:32:18+00:00

me and my colleagues are developing a website with similar idea as Stackoverflow, but

  • 0

me and my colleagues are developing a website with similar idea as Stackoverflow, but for submitting tasks (and for internal use). This morning we talked about tagging tasks and couldn’t really figure which option would be the fastest one, or if we aren’t missing something.

Let’s imagine table with tags, which would dynamically update, depending on users. Users can create any tags and they’d be added to this table. Structure is following:

  • ID
  • name
  • count

I’ll get to actual point now. If you click on, for example, tag “PHP”, it’d show you another page with all tasks tagged with “PHP”. Something similar to this page. Important thing is this list of related tags. How to represent it in database?

Two options came to our minds, but I don’t think any of them is actually the most effective one.

  1. Make select of all tasks with “PHP” tag and check what other tags they contain. In few years we might get an answer from server.

  2. Make a table with cols tag, related tag, count where would be all possible tag relationships. Only problem we see is duplicity. We could have tag PHP and related tag DB2, but we could also have tag DB2 with related tag PHP, which is of course the very same relationship, with the very same count.

I actually quite like option #2, but without duplicity. Perhaps option where there wouldn’t be so close relationship between tags (as if there weren’t any “primary” and “secondary” tags) could work the best. I’m not really very sure at this point and I wouldn’t like to model something that wouldn’t work in the future or would be way too slow if there were, for example, one million tags.

We will use PHP and mySQL or DB2, but I guess that doesn’t matter.

So, the actual questions is: Are there any other, possibly better options? In case of any questions, just ask me.

Thanks in advance.

  • 1 1 Answer
  • 1 View
  • 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-13T11:32:19+00:00Added an answer on May 13, 2026 at 11:32 am

    I assume that you are doing this because want the “show the top N tags related to ‘tag'” query to be really fast.

    If you are doing this in a DB, then your second approach is best. You might even consider creating an index which is ascending on the tag field and descending on the related-tag-count field.

    But if you really want speed, consider representing this as an in-memory data structure.

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

Sidebar

Related Questions

Me and my colleagues got into this discussion early this morning, and our opinions
Colleagues, Preamble. My question is more about best practices. I know one workaround. This
Colleagues have been touting the wonders of maven and its magical dependency stuff but
Colleagues, When I try to use X509 certificate with public key in .cer file,
Context: I sent an email to my colleagues telling them about Enumerable.Empty<T>() as a
My colleagues and I have some misunderstandings about the .NET runtime. I've written a
My colleagues normally use C or Fortran for high performance calculations (math on large
I was debating with some colleagues about what happens when you throw an exception
I am currently developing a jquery function which I intend to use to replace
Today my colleagues and me have a discussion about the usage of the final

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.