mysql強制使用索引: force index(索引名稱)
對table_one表中的id新增普通索引,索引名稱為id_index。新增語句為: alter table `表名` add index 縮影名稱 ( `列名` )
查詢語句:select * from table_one order by id desc limit 10000,10
該語句中通過order by對id進行降序,order by破壞id的索引
select * from table_one force index(id_index) order by id desc limit 10000,10
強制SQL語句使用某個索引
sql語句範例 select fromwith nolock,index ix bydate where billdate and billdate 注 ix bybilldate為此表中根據欄位billdate建立的字段索引。最近接到客戶反映,某個模組的查詢非常慢,經查,此表有8千萬多條記錄,查某...
mysql強制使用索引與不使用索引
oracle可以強制使用索引來優化那些因為種種原因沒走索引的sql mysql支援嗎?答案是肯定的 mysql強制索引和禁止某個索引 1.mysql強制使用索引 force index 索引名或者主鍵pri 例如 select from table force index pri limit 2 強...
MYSQL強制使用索引和禁止使用索引
1 mysql強制使用索引 force index 索引名或者主鍵pri 例如 select from table force index pri limit 2 強制使用主鍵 select from table force index ziduan1 index limit 2 強制使用索引 zi...