Solved

Database Performance (MySQL) versus PHP Performance

Posted on 2011-03-05
4
407 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

739 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