MySQL Forums
Forum List  »  Performance

Re: Reg table design and query performances
Posted by: Øystein Grøvlen
Date: April 26, 2016 07:04AM

Øystein Grøvlen Wrote:
> For the given query, an index on (value, name) is
> probably be better since then all brokers can
> easily be skipped.

Sorry, forget the above.
An index of (name, value) is of course best since that means that one can split the range scan in two ranges, one for (name='role', value<'broker') and one for (name='role', value>'broker').

Hopefully, the optimizer will pick table b as the first table of the join since the (name, value) index should provide direct lookup on (name, value, user_id) to tables a and c. Due to the in-equality expression, look-ups into b will be less efficient since only the first part of the index can be used.

Sorry for the confusion,

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

Options: ReplyQuote

Written By
Re: Reg table design and query performances
April 26, 2016 07:04AM

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.