Well, there is a pit.
Early in the morning for work, other people are in a hurry. The database is severely delayed, a 600 second query. Serious delay in operation.
Under the sql statement:
SELECT * from user where user_id=FLOOR(rand()*10000000);
The effect is to randomly get a user.
analyze
select FLOOR(rand()*10000000);
No problem soon.
SELECT * from user where user_id = 1 , no problem,
soon
SELECT * from user where user_id=FLOOR(rand()*10000000);
Finally found that it is a full table scan, this function does not take the index. . I have a headache.
The random number is placed, and the application layer is generated.