Data-Diggers.com | Zen Cart Optimization, Performance and A/B Split Testing Modules for Zen Cart

TAG | index

Jun/09

29

Speed up admin/orders.php page

There’s suboptimal query in admin/orders.php page which retrieves information about last orders. Unfortunately query is constructed in such way that MySQL scans whole orders, orders_products and orders_total table. As always it’s not a problem until orders table gets big ( for example 50 000 entries ). If You happen to have at least 10 000 [...]

, , , ,

I noticed that following query takes long time to execute:

SELECT DISTINCT op.products_id
FROM orders o, orders_products op, products p
WHERE o.customers_id = ‘2345′
AND o.orders_id = op.orders_id
AND op.products_id = p.products_id
AND p.products_status = ‘1′
GROUP BY products_id
ORDER BY o.date_purchased DESC
LIMIT 6

I noticed that there’s no index on orders table on customers_id field. Without it MySQL has to scan whole table [...]

, , , ,

Find it!

Theme Design by devolux.org