Re: Reg table design and query performances
Ø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