一、mysql强制加锁,
将 table1 设为read锁, table2 设为write锁, table3 设为read锁
lock tables [table1] read,[table2] write,[table3] read;
解锁
unlock tables
二、强制使用索引
FORCE INDEX
SELECT * FROM TABLE1 FORCE INDEX (FIELD1) …
三、强制忽略索引
IGNORE INDEX
SELECT * FROM TABLE1 IGNORE INDEX (FIELD1, FIELD2) …
四、关闭查询缓存
关闭查询缓冲 SQL_NO_CACHE
SELECT SQL_NO_CACHE field1, field2 FROM TABLE1;