Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question on the amount of tables and queries a project should use

Status
Not open for further replies.

scorpion4377

Programmer
Apr 11, 2005
13
US
I recently made a site in PHP and MySQL where you can, with a valid code, add a poll with 2-5 choices. Your poll is added automatically, and everybody can vote on it.

I have three tables:
-Codes (Stores valid codes)
-Polls (Stores the questions, information about who added the poll, and the choices)
-Votes (Stores who voted for which choice in which poll)

Everytime somebody tries to add a poll, three MySQL querys are sent.
1. Checks if the code you used is valid
2. It changes the code's structure so it can't be used again
3. Adds the poll

Everytime somebody votes on a poll, the MySQL server has to deal with 3 queries.

Now. Do you think that 3 tables for a project like this is reasonable? What about the amount of queries? Do queries waste a lot of bandwidth? I'm fairly new to MySQL (A month with MySQL, about 7 in PHP)

Thanks.
 
Usually the MySQL server is local to the system that runs the web server/PHP. An internal communication, e.g. using a UNIX domain socket is very fast.
1. 3 tables for that project seems appropriate and reasonable.
2. The amount of queries is necessary and by no means excessive.
3. Queries only use bandwith if the MySQl is accessed via a TCP/IP connection which is not generally the case.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top