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

  • Home
  • SEARCH
  • 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 293855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:18:49+00:00 2026-05-12T06:18:49+00:00

If we look at the stackoverflow website we have votes. But the question is

  • 0

If we look at the stackoverflow website we have votes. But the question is what is the bestway to store who has voted and who has not. Lets also simplify this even more and say that we can only vote Up, and we can only Remove the Up vote.

I was thinking having the table to be in such form

question - Id(INT) | userId(INT) | title(TEXT) | vote(INT) | ratedBy(TEXT)

Thre rest is self explanitory but ratedBy is a Comma Seperated Id values of the Users.

I was thinking to read the ratedBy and compare it with the userId of the current logged in User. If he dosent exist in the ratedBy he can vote Up, otherwise he can remove his vote. Which in turn will remove the value from ratedBy

  • 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-12T06:18:50+00:00Added an answer on May 12, 2026 at 6:18 am

    I think to make another table “vote” is better. The relationship between users and votes is n to n, therefore a new table should be created. It should be something like this:

    question id (int) | user id (int) | permanent (bool) | timestamp (datetime)
    

    Permanent field can be used to make votes stay after a given time, as SO does.
    Other fields may be added according to desired features.
    As each row will take at least 16B, you can have up to 250M rows in the table before the table uses 4GB (fat32 limit if there is one archive per table, which is the case for MyISAM and InnoDB).
    Also, as Matthew Scharley points out in a comment, don’t load all votes at once into memory (as fetching all the table in a resultset). You can always use LIMIT clause to narrow your query results.

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

Sidebar

Ask A Question

Stats

  • Questions 178k
  • Answers 178k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Attention! Pseudocode! public interface IMyMasterPage { string ThemeChooserID { get;… May 12, 2026 at 3:41 pm
  • Editorial Team
    Editorial Team added an answer If you want to do this without a Regex it… May 12, 2026 at 3:41 pm
  • Editorial Team
    Editorial Team added an answer Have a look to this wiki: LaTeX/Labels and Cross-referencing: The… May 12, 2026 at 3:41 pm

Related Questions

I don't know if this is the place to ask about algorithms. But let's
This is related to the question about return type attributes and anonymous classes ,
According to this article from Herb Sutter, one should always pick Class Specializing over
You may think this question is like this question asked on StackOverflow earlier. But

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.