I can’t say in Mysql specifically (nor do I think it matters, I hope it doesn’t :P). There is probably no advantage if it is an index with a single column and/or enumeration so simple, but I do not say with such certainty.
If it’s a record of engineers, there might be a profit in it when you go looking for women. Why keep looking in the entire database to get 1% of the lines? I can’t guarantee that the results will be that much better for that 1%, but they certainly won’t be for the 99%.
So it depends on the case and has to do tests with the actual database.
It would certainly be more interesting if the enumeration column/boolean were part of the composite index.
It would be more interesting if this column were calculated from others and was a helper precisely to filter a certain complex condition and facilitate certain searches.
Some databases even have special index for this by mapping the bits and creating a compact index. This index can be used in a specific condition, in general it is not used in a Boolean column. The index is created based on an expression where
and the result is that it is indexed, so it can already quickly select the lines that satisfy this condition. This is done internally and the developer cannot previously create this type of index.
Ask with a case that shows that the index doesn’t always help how people think.
@bigown has no sense with what I’m asking that question there. I wonder whether or not I can use
INDEX
in a fieldENUM
for performance improvement. In fact, I want to know if you have any advantage over values withINDEX
like theVARCHAR
for example.– Wallace Maxters
Related: http://answall.com/q/81801/101
– Maniero