Hi,
I have a database with over 12,000 products. The ecommerce system works fine on other sites, which have a lot less products.
Problem is, it simply won’t work with this database, probably slow performance before timeout. My query is:
$q = "
SELECT p.*, b.brandName, pr.price, pr.offerTypeID
FROM ".DB_PREFIX."categories node
JOIN ".DB_PREFIX."categories parent
ON node.lft BETWEEN parent.lft AND parent.rgt
JOIN ".DB_PREFIX."catmembers cm
ON cm.categoryID = node.categoryID
JOIN ".DB_PREFIX."products p
ON p.productID = cm.productID
LEFT JOIN ".DB_PREFIX."brandmembers bm
ON bm.productID = p.productID
LEFT JOIN ".DB_PREFIX."brands b
ON b.brandID = bm.brandID
LEFT JOIN ".DB_PREFIX."prices pr
ON pr.productID = p.productID
AND (pr.dateFrom <= '".strtotime("Today")."' AND pr.dateTo >= '".strtotime("Today")."')
WHERE productDisplay = 1
";
Even running it direct from the server takes a long time. (Infact it’s still running. It takes around 4 seconds to get every row in the 12000 table).
Is the problem with the statement? Or is there a way I could optimize the table.
Cheers,
Rhys