A joint survey of several big data scales

During the interview today, the interviewer asked a question, table a 100W, table b 500W. If table an and table b are checked together, the query speed is very slow, how to optimize it?

the interviewer said the index was perfect. I didn"t answer at that time.

Aug.13,2021

1, first of all, explain looks at the execution order of mysql and whether there is a "perfect" index used correctly;
2, then when it comes to 100w and 500w, see if the result is a small table driving a large table, if not, use a STRAIGHT_JOIN association to force the driver table to try;
3, see whether deferred queries can be used to override the index
.
personal opinion is not quite sure of the interviewer's intention, but the explain analysis must be


you can take a look at the following optimization ideas.
mysql two tables association optimization

Menu