
Originally Posted by
swguy
> This is something I found interesting with RecentOrdersDashboardWidget.php causing the index page to load extremely slow and it seems to have been caused by partial data in one of the orders tables...
@balihr would you please provide an example of something that induces this? I'd like to add this check to the audit tool.
I don't have all the details just yet because it's still WIP. The version upgrade wasn't done by me, but it's a dev site with an upgraded DB and the orders table has only a few hundred of the latest orders, whilst all other orders_ tables have a lot more records (the live site has over 100k orders in the DB). I have no idea how or why the orders table was chopped, but both the index page and orders page are extremely slow to load. I changed RecentOrdersDashboardWidget.php from
Code:
$sql = "SELECT o.orders_id as orders_id, o.customers_name as customers_name, o.customers_id,
o.date_purchased as date_purchased, o.currency, o.currency_value,
ot.class, ot.text as order_total, ot.value as order_value
FROM " . TABLE_ORDERS . " o
LEFT JOIN " . TABLE_ORDERS_TOTAL . " ot ON (o.orders_id = ot.orders_id AND class = 'ot_total')
ORDER BY orders_id DESC";
to
Code:
$sql = "SELECT o.orders_id as orders_id, o.customers_name as customers_name, o.customers_id,
o.date_purchased as date_purchased, o.currency, o.currency_value,
ot.class, ot.text as order_total, ot.value as order_value
FROM " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot
WHERE o.orders_id = ot.orders_id AND ot.class = 'ot_total'
ORDER BY orders_id DESC";
and it worked like a charm.
Didn't investigate any further because I asked for clarification why the orders table was butchered and am awaiting info.
Bookmarks