MySQL Forums
Forum List  »  InnoDB

Re: A very slow query on InnoDb 5.1.67
Posted by: Rick James
Date: April 23, 2013 08:17AM

You have slow queries; I have slow reading... (Sorry, but I am distracted by the verbosity of the naming style.)

rmm_sales_order_row.sales_order_row_quantity,
...
LEFT JOIN rmm_modules_payment
ON rmm_sales_order.method_payment_id = rmm_modules_payment.method_id

LEFT JOIN rmm_modules_shipment
ON rmm_sales_order.method_shipment_id = rmm_modules_shipment.method_id
-->
sr.row_quantity,
...
LEFT JOIN modules_payment AS mp   ON s.method_payment_id  = mp.method_id
LEFT JOIN modules_shipment AS ms  ON s.method_shipment_id = ms.method_id
* Toss table name (in column name)
* Toss database name (in table name)
* Use aliases

Back to the question...

Do you need LEFT? Or would JOIN suffice? I suspect you have no missing data. It is especially strange to be doing GROUP BY on something that might be NULL (according to the use of LEFT JOIN).
Are all the ids the PRIMARY KEYs of their respective tables?

Please try this: Go back to the original SELECT, remove LEFT everywhere, and see how fast it runs. (And whether removing the LEFTs was 'correct'.) If that doesn't speed things up, then please provide
SHOW CREATE TABLE ...
EXPLAIN SELECT...
SHOW TABLE STATUS...
Those will help in further analysis.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: A very slow query on InnoDb 5.1.67
1193
April 23, 2013 08:17AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.