Adam Adam - 1 year ago 79
MySQL Question

MySQL Slow Query - Order By

I have the following SELECT that runs in under a second if I remove the ORDER BY at the end. With the ORDER BY it runs in around 9 seconds.

I have a ruff understanding that some other SQL commands like '< >' comparison operators can work adversely with an ORDER BY.

I've tried commenting out lines and can improve the performance to say 2-3seconds with the ORDER BY but still without the ORDER BY its more like under 1 second.

Can someone give me some good advise on how to better write this query, what to avoid etc? All advise is greatly appreciated.


Answer Source

please try:


LIMIT 120;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download