MySQL Forums
Forum List  »  Performance

Re: MySQL 5.5 Queries occasionally extremely slow
Posted by: Rick James
Date: March 05, 2014 10:32PM

> WHERE latitude != '0.000000' AND activedate >= inactivedate

What percentage of the rows are filtered out by tose conditions?
Consider removing the rows that are not relevant.

> Group By Projects.ProjectID
> ORDER BY Projects.ProjectID ASC, source.sort_order ASC

The GROUP BY ends up with unique values for ProjectID, so the second part of the ORDER BY never does anything extra.

> LIMIT 30000

Is that a realistic limit? What happens if you take off the limit?

> SELECT lots of stuff
> Group By Projects.ProjectID

Do you understand that you get random values for the stuff that is not tied directly to ProjectID?

Or are you doing the GROUP BY just in case some of the JOINs generate multiple rows?

Since you have a GROUP_CONCAT(), I guess you are expecting multiple rows, but from which table?

If the GROUP_CONCAT() is coming from just one table, then this _might_ run faster:
SELECT ...
( SELECT GROUP_CONCAT FROM ... WHERE ... GROUP BY ... ) AS images_list,
...
then remove the relavant JOIN and outer GROUP BY.

Please, please, tag each field with an alias of the table it belongs to. It is hard to know what is coming from where. Also, shorter aliases help reduce clutter.

Please provide SHOW CREATE TABLEs.

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: MySQL 5.5 Queries occasionally extremely slow
985
March 05, 2014 10:32PM


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.