If the second index after the first?

Pretty much read techniques for optimizing queries by using indexes. It turned out that prior to this my knowledge of indexes was quite fragmentary and inaccurate. But one factor I couldn't quite clearly figure out.
Let there is table user with fields id, date, sex, name. We can create compound index(date, sex).
In connection with this first question:
does it matter the order the very conditions in the query. That is, whether the difference between
select * from user WHERE date='2016-03-03' AND sex='male' And
select * from user WHERE sex='male' AND date='2016-03-03' ?
Or is MySQL smart enough to place everything in the correct order for the index?

And, actually, the second question. If we impose separately the indexes on date and sex. Yes, it will be less effective than a comprehensive index, but will involve both indices, or only the first that will fall, and the second will be lost?
July 12th 19 at 16:47
2 answers
July 12th 19 at 16:49
There are a few points:
1). Yes, the order of the terms in the query in this case is irrelevant
2). If iindex separate, then the query planner can use both, BUT:
3). In this case, an index on sex has very poor selectivity ( www.akadia.com/services/ora_index_selectivity.html ), so I would put a half-eaten cucumber against the Portuguese Escudo to use the index on date and a sequential scan of what came out
4). However, to finally clarify for themselves what is really used, you need to run and explain these issues will disappear ( and will be new :))
Actually, EXPLAIN already launched, still wanted to clarify these points. - Kellen.Jacobi40 commented on July 12th 19 at 16:52
On account of the bad selectivity - I about it know, just no way to explain in simpler example. - Kellen.Jacobi40 commented on July 12th 19 at 16:55
July 12th 19 at 16:51
The order of conditions in a query does not matter. mysql is stupid, but fortunately not to this extent.

On the second question: at the discretion of the scheduler. index merge mysql can, but it may be more expensive than searching in one index and further filtration.

Find more questions by tags MySQLSQL