Solved

Database Performance (MySQL) versus PHP Performance

Posted on 2011-03-05
4
408 Views
Last Modified: 2012-05-11
Which of the following two options will perform the best (generally) where both MySQL and PHP are running on the same server?

Choice #1
Request 100 rows from a database table.

The database connection will have already been opened, I am only interested in the query performance itself.

Choice #2
Load a cached PHP script which includes the 100 rows (which are very rarely changed - if at all).
0
Comment
Question by:numberkruncher
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 39

Accepted Solution

by:
Aaron Tomosky earned 250 total points
ID: 35044468
So small you won't know the difference. 100 rows is nothing. May as well just leave it in mysql.
0
 
LVL 13

Author Comment

by:numberkruncher
ID: 35044478
Really?

At the moment my pages are receiving between 8 and 10 queries per request. It is early stages and this quantity is likely to increase to up to 30 queries per request.

If the difference is minuscule then I shall just stick to a simple MySQL query.

Thanks, that helps give me perspective on who efficient MySQL is.
0
 
LVL 9

Assisted Solution

by:Vampireofdarkness
Vampireofdarkness earned 250 total points
ID: 35044507
These are things I often find myself wondering about. Cached vs not, enum 0/1 vs tinyint(1), etc...

I ran some tests on updating rows (x=1-x, x!=x and more) it takes something like 0.9 seconds to run 1,000 UPDATE queries on my home 'general use' PC. The difference between two was around 0.2 seconds, but that is still for 1,000 updates all happening at once so 0.0002 seconds per pass. I think I read somewhere it takes 30-40 (0.0400) milliseconds to blink, just to put it into perspective.  

In short, what aarontomosky said. 100 rows is nothing. Focus more on making your code bomb proof and functional.

If you're still in doubt, run some benchmarks. You'll be able to see the exact difference in milliseconds between the two (and it will be milliseconds if anything).
0
 
LVL 13

Author Closing Comment

by:numberkruncher
ID: 35044516
Thanks for the input guys!
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question