解决的办法就是在每个select语句前加上explain, 如果返回的结果是type = ALL的话,表示对全表检查. 如果type=all并且rows>500,基本上你这条sql语句就需要优化了. EXPLAIN SELECT * FROM `ttttt` WHERE 1 执行结果 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE ttttt index NULL t1 514 NULL 3 Using index explain详细用法请参看手册.
如果type=all并且rows>500,基本上你这条sql语句就需要优化了.
EXPLAIN SELECT * FROM `ttttt` WHERE 1
执行结果
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE ttttt index NULL t1 514 NULL 3 Using index
explain详细用法请参看手册.