views:

135

answers:

4

Hey, I'm doing a website that requires me to use about 5 mysql "SELECT * FROM" queries on each site and I'd like to know if it can slow the download speed in any way.

A: 

Sure. Especially if the tables contain lots or rows.

Sam
A: 

If you have queries that take a long time, then the page will appear to take longer to load. Once the server has finished creating the HTML to send to the client (where the queries happen), the download speed will depend on how big the content of the page is.

JamesMLV
A: 

Yes.

Here are some useful links to help you understand how to measure MySQL performance and make changes to improve it:

Linux Mag MySQL Tuning article

MySQL Docs (Memory Use)

MySQL Performance Cookbook

Eric J.
+1  A: 

MySQL will have no impact on the download speed (i.e., the time it takes for HTML content to get from your server to a visitor's web browser). However, they may create a delay between when your server gets the request and when it can send that HTML. Here's the sequence of events:

  1. Visitor sends a request: "Please send me example.com/some-page"
  2. Your server does some work to generate what some-page is supposed to look like and produce appropriate HTML
  3. Your server sends that page to the visitor

MySQL doesn't affect #1 or #3, but of course it's a key part of what's happening in #2.

The big question is: how much of an impact will it have. If your five SELECT queries are each selecting one row from a table with only a hundred rows, the total impact on performance will be negligible.

If, on the other hand, each query is doing complex JOINs and subqueries on large tables, you could easily notice a difference.

The easiest way to get a sense of this impact is to connect directly to your MySQL server (i.e., not through your PHP script) and run those queries to see how long they take. If they're running slowly, you can always come back to StackOverflow for advice on how to make a particular query run more efficiently.

VoteyDisciple