Author Topic: Auto Thumbnailer and Admin Query Optimization  (Read 3419 times)

0 Members and 1 Guest are viewing this topic.

Offline raytaylor

  • Pre-Newbie
  • Posts: 4
    • View Profile
Auto Thumbnailer and Admin Query Optimization
« on: July 12, 2007, 04:00:16 PM »
Hey guys.
I dont know much about php except I have made a simple flat file database to run a website so I know the ultra basics of a query.

My gallery website now has over 15,000 images and is based on 4images.
Unfortunatly, It has got harder and harder to run the auto thumbnailer for new images I have added. As more images are in the database, the slower it gets. Now its completly impossible. The statistics on the admin front page also no-longer work, yet the statistics for the gallery front page do work - and fast too.

My main concern is the auto thumbnailer as I use it quite a lot.
I now get a execution error when the script executes and doesnt finish beyond a set time. This was originally 30 seconds. I have since had to adjust the setting in my php.ini file right up to 120 seconds - and even so its still not long enough.

I looked on the web for mysql optimization techniques and found that I could use an index to speed things up. I then opened phpmyadmin and made the image_thumb_file field a key.

After that, I went to the thumbnailer.php in the admin folder and found the query:
Approx Line 104
Quote
if (isset($HTTP_POST_VARS['action']) && $HTTP_POST_VARS['action'] == "checkthumbnails") {
  $sql = "SELECT image_id, image_name, cat_id, image_media_file, image_thumb_file
          FROM ".IMAGES_TABLE;

What I need to know is how to change this SELECT fields FROM .IMAGES_TABLE and add a WHERE image_thumb_file = empty field on the end.
I also ask if this should be the query I am wanting to edit. The idea is that by using an index on the thumb file field, it will skip ahead anything that has something in the field, and only report the rows / images that are of concern and lower the processng. This is because I have about 5 images at a time without thumbs in a database of 15,000.

I have tried adding
WHERE image_thumb_file = '' onto the end as the google results told me to but I think I am having a problem with the ' ' and " " quotations as I dont know which I need to use and if the rest of the query would need them.

Any help with this is much appreciated.


Ray



Offline raytaylor

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: Auto Thumbnailer and Admin Query Optimization
« Reply #1 on: July 12, 2007, 04:03:10 PM »
Here is the error message I am getting when I use the auto thumbnailer to display a default of 10 images.

Fatal error: Maximum execution time of 180 seconds exceeded in thumbnailer.php on line 114