Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
>We need a composite age_gender index because MySQL only uses 1 index >a query
in 5.7 has a merge of indexes.
queries can use the first fields of compound indexes.
SELECT * FROM `users` WHERE `age` > 20 AND `gender` = 'male' ORDER BY `name`
SELECT * FROM `users` WHERE `age` > 20 AND `gender` = 'male' ORDER BY `rating`
these two queries can use the index (age, gender, rating)
the second query can use the index (age, gender) but only for filtering sorting will be on disk (using filesort) uncritical for small samples.
you need to understand that indexes also eat resources, so you should not abuse them. Make a lot of indexes and as a result, for example, get a very slow write to the database. Therefore, it is not necessary to cover all queries with indexes during the development process. It’s better to turn on the slow query log in MySQL and, based on the data from it, determine how to optimize this or that query - put an index or do something else
What exactly is the problem?
A triangle exists if the sum of the legs (two smaller sides) is not equal to the hypotenuse (larger side), but rather more than it (and necessarily more).
The algorithm is as follows:
1) Find the largest side
2) Compare with the sum of the other two
3) If equal or less than the hypotenuse, it is impossible to build such a triangle.
Or is it a matter of what blocks to use to build the circuit?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question