Well i have been with a website not naming the hosts name , but this is the 2nd time its happened. First time was without any traffic and this time with 280 people on my website. I promoted a image on facebook should a shared webhost be able to handle this kinda traffic? Can you tell me what the below means. I edited the database name and stuff to private as i do not want it public. LOGS: 552388 private localhost private Query 3 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 20 552389 private localhost private Query 3 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 20 552391 private localhost private Query 3 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 20 552393 private localhost private Query 3 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 20 552394 private localhost private Query 3 Sending data SELECT * FROM images WHERE active=1 and id>526 ORDER BY id ASC LIMIT 1 552395 private localhost private Query 3 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 20 552396 private localhost private Query 3 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 20 552399 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id>526 ORDER BY id ASC LIMIT 1 552402 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id<526 ORDER BY id DESC LIMIT 1 552405 private localhost private Query 3 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 1 552406 private localhost private Query 3 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 1 552407 private localhost private Query 2 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 1 552408 private localhost private Query 3 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 1 552409 private localhost private Query 3 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 1 552410 private localhost private Query 2 Copying to tmp table SELECT * FROM images WHERE active=1 ORDER BY RAND() LIMIT 1 552412 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552411 private localhost private Query 3 Updating UPDATE images SET hits='509' WHERE id='526' 552413 private localhost private Query 3 Updating UPDATE images SET hits='509' WHERE id='526' 552414 private localhost private Query 3 Updating UPDATE images SET hits='509' WHERE id='526' 552415 private localhost private Query 3 Updating UPDATE images SET hits='16' WHERE id='525' 552418 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552422 private localhost private Query 4 Updating UPDATE images SET hits='509' WHERE id='526' 552423 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552424 private localhost private Query 4 statistics SELECT * FROM images WHERE active=1 and id='527' LIMIT 1 552425 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552426 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552427 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552430 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552432 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552433 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552434 private localhost private Query 3 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552435 private localhost private Query 2 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552436 private localhost private Query 1 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1 552437 private localhost private Query 1 statistics SELECT * FROM images WHERE active=1 and id='526' LIMIT 1
This looks to be SQL queries, but no errors. Have you tried to repair/optimize the database over phpmyadmin?
Well the host said the errors above was lagging and crashing the server. They are doing some optimizeing as of now.
Well looks like they fixed the issue now , my site was loading a lot of thumb images on each page so i turned them off and its all good now.
I can almost guarantee you that it's the ORDER BY RAND() that is causing the issue. Instead of making MySQL do the work, use PHP shuffle() function against the result array, and pick out of the top 10 keys of that array.
Zach is right on the money. It is in the scripting itself, you would need to have a function you are using swapped. Also, MySQL is not as big of a problem as some make it our to be, it only becomes a problem when your server is not properly administrated and routine optimization is not conducted.