Our site receives about 7000 uniques a day. With about 50,000 page views.
15 Categories + 30 ish Subcategories
3500 Products.
Our server load tends to hover around 3 or 4 - (Linux Debian 1gb Memory etc)
Looking at the Mysql logs I noticed that all the SQL seemed to be doing was counting categories even with the Mysql Cache on
Basically everytime the categories menu loaded it was counting the directorys from the DB. Thousands and thousands of times a day!!!
I removed the category count function from /catalog/includes/boxes/categories.php and removed the corresponding function in catalog/includes/functions/general.php
this bit:-
////
// Return true if the category has subcategories
// TABLES: categories
function tep_has_category_subcategories($category_id) {
$child_category_query = tep_db_query("select count(*) as count from " . TABLE_CATEGORIES . " where parent_id = '" . $category_id . "'");
$child_category = tep_db_fetch_array($child_category_query);
if ($child_category['count'] > 0) {
return true;
} else {
return false;
}
}
////
The server has dropped down to a load average of 1 ish and the site absolutely zooooms now :-)
Cheers
Edited by monkeymoo1, 08 May 2006, 21:44.















