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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:45:01+00:00 2026-06-11T03:45:01+00:00

I am working on a Project in which i have Voting Options Up and

  • 0

I am working on a Project in which i have Voting Options Up and Down similar to StackOverFlow. I am not much experienced in DB Designing and thus i got up with the following issue,

First of all, here is my table structure for voting :

  1. voteId—–AUTO_INCREMENT with PRIMARY KEY.
  2. mediaId—-The Media for which user gives an up/down vote.
  3. userId—–The User who Voted.
  4. voteMode—1 for Up Vote and 0 for Down Vote. This is an Integer Field.

In this case if i have 100 users and 100 medias, then i will have 100×100 records all total in this table.

The Problem arises here is the DB is getting up with a lot of records and the vote button is dead slow to react now. This is making my client unhappy and me in trouble.

Can anyone suggest me a better model to avoid this Huge Table?

I am using jQuery.ajax to post my vote to server. Also, the project is based on PHP and Zend Framework 1.11. So when i click on UP Icon, it will take some time to respond. Mozilla used to Crash certain times. I tested with inserting via a loop with lots of junk records (around 15000).

  • 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-11T03:45:02+00:00Added an answer on June 11, 2026 at 3:45 am

    You can try these up gradation of your table schema:

    //All id's are now unsigned , As you do not need any sign 
    ALTER TABLE `voting` 
    CHANGE `voteid` `voteid` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
    CHANGE `mediaId` `mediaId` INT(11) UNSIGNED NOT NULL, 
    CHANGE `userId` `userId` INT(11) UNSIGNED NOT NULL, 
    //ENUM datatype as you need only 2 type of value
    CHANGE `voteMode` `voteMode` ENUM('1' , '2') NOT NULL ; 
    
    //Adding index , it will surely increase some speed
    //Do **not use** index in **columns you do not need**
    ALTER TABLE  `voting` ADD INDEX (  `mediaId` ,  `userId` ) ;
    

    Go through Mysql Index to know more about indexing.

    If you are using MyISAM Storage Engine , then i will suggest you to go for InnoDB Storage Engine. It may help you to decide about which engine you should use.

    And some other hacks that may help you are:

    1. MySQL Query Cache
    2. Prepared Statements in php
    3. COLUMNS Partitioning

    Some resources about MySql Database optimizations :

    1. MySQL Tuning
    2. Mysql Optimization
    3. Real World Scalability MySQL.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project in which we have a database, data layer (entity
hello all i am working on a project in which i have a webpage
My problem/issue We are working on an opensource project which we have hosted on
I'm working on a project which will end up have a lot of application
I have just begun working on a project which uses Mercurial as a version
I have started working on a project which requires Natural Language Processing. We have
I am working on a hobby project in which I have to crawl different
I have a project which I am working on and it has multiple files
I have a project which I am working on and it has multiple files
I have created a wix installer project which is working fine. It installs my

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.