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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T10:31:27+00:00 2026-05-31T10:31:27+00:00

Let’s say I would like to store votes to polls in mysql database. As

  • 0

Let’s say I would like to store votes to polls in mysql database.

As far as I know I have two options:

1. Create one table (let’s say votes) with fields like poll_id, user_id, selected_option_id, vote_date and so on..

2. Create a new database for votes (let’s say votes_base) and for each poll add a table to this base (a table, which consist the id of the poll in the name), let’s say poll[id of the poll].

The problem with the first option is that the table will become big very soon. Let’s say I have 1000 polls and each poll has 1000 votes – that’s already a million records in the table. I don’t know how much of the speed performance that will costs.

The problem with the second option is I’m not sure if this is the correct solution from the programming rules point of view. But I’m sure with this option it will be (much?) faster to find all votes to some poll.

Or maybe there is a better option?

  • 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-31T10:31:28+00:00Added an answer on May 31, 2026 at 10:31 am

    Your first option is the better option. It is structurally more sound. Millions of rows in a table is no problem from MySQL. A new table per poll is an antipattern.

    EDIT for first comment:

    Even for a billion or more votes, MySQL should handle. Indexes are the key here. What is the difference between one database with 100 times the same table, or one table with 100 times the rows?

    Technically, the second option works as well. Sometimes it might be even better. But we frequently see this:

    • Instead of one table, users, with 10 columns
    • Make 100 tables, users_uk, users_us, … depending on where the users are from.

    Great, no? Works, yes? Well it does, until you want to select all the male users, or join the users table onto another table. You’ll have a huge UNION coming, and you won’t even know the tables beforehand.

    One big users table, with the appropriate indexes, is better. If it gets too big for your liking (or your disk), you can start with PARTITIONING: you still have the benefit of one table, but the partitions are stored on different locations.

    Now, with your polls, these kind of queries might not happen. In that case, one big InnoDB table or 1000s of small tables might both work.. but the first option is a lot easier to program, and has no drawbacks over the second option. Why choose the second option?

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

Sidebar

Related Questions

Let's say I have table with column 'URL' whrere I store urls like this
Let's say i have a mysql database table 'article' with the following fields: id
Let's say i have two tables in db: Car and Part. Car owns arbitrialy
Let’s say I have a number like 0x448 . In binary this is 0100
Let's say I have a structure named vertex with a method that adds two
Let's say I have two tables orgs and states orgs is (o_ID, state_abbr) and
Let's say I have a text file composed like this ##### typeofthread1 ##### typeofthread2
Let's say that I have a set of relations that looks like this: relations
Let say I have two UIViews: View1: - bounds: 0, 0, 20, 20 -
Let's say I have two assemblies: BusinessLogic and Web. BusinessLogic has an application setting

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.