MySQL Forums
Forum List  »  Performance

Re: slow response when where clause has a field from 2nd table in a left join
Posted by: Øystein Grøvlen
Date: February 15, 2016 02:10AM

Hi,

Your post leaves me a bit confused. You say that you need to use LEFT JOIN, but your view uses INNER JOIN. You talk about a "case_name index" index, but I do not see any index nor column with that name in the table definitions.

Anyhow, I am not surprised that your query takes much longer when adding an OR condition. Without the second condition, only rows from the first table with "cascades = 'abc'" need to be considered. With the OR condition, any row of the first table might be a candidate. Hence, a lot more rows will have to be looked up in the second table. I would think you can speed up the query by adding a combined index on current_alarms(alarm_key, element), but it will never be as fast as the query without the second condition.

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

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: slow response when where clause has a field from 2nd table in a left join
761
February 15, 2016 02:10AM


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.