MySQL Forums
Forum List  »  Performance

Re: index not being pick up
Posted by: Øystein Grøvlen
Date: January 19, 2018 07:26AM

Hi,

It is the presence of an OR expression that causes the optimizer to not use the index. You could try to split the OR expression using a UNION query, but then the view would probably not be merged, but instead stored in a temporary table which could potentially be very large.

For the given query, I think the best would be to reverse the column of the index. That is, create an index on (reference, scope_id).

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

Options: ReplyQuote


Subject
Views
Written By
Posted
1213
r r
January 15, 2018 11:57PM
502
January 16, 2018 12:19AM
450
January 16, 2018 04:39PM
477
January 16, 2018 07:49PM
491
January 17, 2018 12:26AM
479
January 17, 2018 01:07AM
700
January 17, 2018 01:19AM
511
January 17, 2018 12:41PM
Re: index not being pick up
476
January 19, 2018 07:26AM
484
January 21, 2018 04:31PM
450
January 21, 2018 05:41PM
533
January 22, 2018 03:00AM


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.