MySQL Forums
Forum List  »  Performance

Re: query performance optimization
Posted by: Øystein Grøvlen
Date: January 19, 2016 02:30AM

Hi,

I am not able to understand what your query is supposed to do. The GROUP BY clause puzzles me:

GROUP BY SFO.entity_id AND SOIT.id_tags IN (2,3,8,10,11,12)

Grouping on a logical expression means you will get two groups, one for the rows where the expression is TRUE and one for rows where the expression is FALSE (and maybe an additional NULL group if SOIT.id_tags happens to be NULL for some rows.) This does not make much sense since you will just get data from some arbitrary row within each group. In this context, LIMIT 5 does not make much sense either since there will never be more than 3 rows in the result.

Which version of MySQL are you using?

Øystein Grøvlen,
Senior Principal Software Engineer,
MySQL Group, Oracle,
Trondheim, Norway

Options: ReplyQuote


Subject
Views
Written By
Posted
2238
January 18, 2016 04:49AM
Re: query performance optimization
918
January 19, 2016 02:30AM
1004
January 22, 2016 06:29PM
877
January 22, 2016 01:08PM
980
January 22, 2016 11:10PM


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.