mysql oder by 使用index一例
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use lvh
Database changed
mysql> explain select * from job_queue where 1=1 order by opt_time desc ;
+----+-------------+-----------+------+---------------+------+---------+------+--------+----------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------+------+---------------+------+---------+------+--------+----------------+
| 1 | SIMPLE | job_queue | ALL | NULL | NULL | NULL | NULL | 454244 | Using filesort |
+----+-------------+-----------+------+---------------+------+---------+------+--------+----------------+
1 row in set (0.00 sec)
mysql> explain select * from job_queue where 1=1 order by opt_time desc limit 100,10;
+----+-------------+-----------+-------+---------------+--------------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------+-------+---------------+--------------+---------+------+------+-------+
| 1 | SIMPLE | job_queue | index | NULL | ind_opt_time | 9 | NULL | 110 | |
+----+-------------+-----------+-------+---------------+--------------+---------+------+------+-------+
1 row in set (0.00 sec)
mysql> explain select * from job_queue order by opt_time desc limit 100,10;
+----+-------------+-----------+-------+---------------+--------------+---------+------+------+-------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-----------+-------+---------------+--------------+---------+------+------+-------+
| 1 | SIMPLE | job_queue | index | NULL | ind_opt_time | 9 | NULL | 110 | |
+----+-------------+-----------+-------+---------------+--------------+---------+------+------+-------+
1 row in set (0.00 sec)
mysql>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-731553/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Mysql——index(索引)使用MySqlIndex索引
- MySQL index hints 使用MySqlIndex
- sql優化一例(index_desc)SQL優化Index
- no_index最佳化sql一例IndexSQL
- <MYSQL Index>MySqlIndex
- mysql 索引( mysql index )MySql索引Index
- MySQL使用者許可權控制一例MySql
- enq: TX - index contention故障修復一例ENQIndex
- MySQL Index Condition Pushdown(ICP)的使用限制MySqlIndex
- MySQL誤刪root使用者恢復一例MySql
- MySQL:死鎖一例MySql
- MySQL SLAVE故障一例MySql
- mysql 引數修改 一例MySql
- mysql hint憂化一例MySql
- mysql slave 損害一例MySql
- MYSQL中的type:index 和 Extra:Using indexMySqlIndex
- 【Mysql】index extensions介紹MySqlIndex
- mysql的Covering IndexMySqlIndex
- mysql儲存過程一例MySql儲存過程
- 遭遇mysql 5.6.10 BUG 一例MySql
- Index of /Downloads/MySQL-5.5/IndexMySql
- 【Mysql】MySQL · 特性分析 · Index Condition Pushdown (ICP)MySqlIndex
- JsTree使用一例JS
- MySQL 5.7鎖的問題一例MySql
- 解決mysql innodb page corrupt一例MySql
- 【MySQL】Merge Index導致死鎖MySqlIndex
- mysql 函式substring_index()MySql函式Index
- mysql loose index scan的實現MySqlIndex
- B-index、bitmap-index、text-index使用場景詳解Index
- Linux UDEV使用一例Linuxdev
- 處理mysql複製故障一例薦MySql
- 使用Index提示 強制使用索引Index索引
- MySQL使用GRANT授權某使用者瀏覽和修改表許可權操作一例MySql
- 查詢使用表空間的TABLE,INDEX,INDEX SUBPARTITIONIndex
- 【INDEX】使用“alter index ××× monitoring usage;”語句監控索引使用與否Index索引
- LINUX救援模式使用一例Linux模式
- 故障分析 | MySQL鎖等待超時一例分析MySql
- MySQL的SQL語句最佳化一例MySql