- select_type: 表示 select 类型,常见的取值有:
- simple:简单表,及不应用表连接或者子萌芽
- primary:主萌芽,即外层的萌芽
- union:union 中的第二个或后面的萌芽语句
- subquery: 子萌芽中的第一个 select
- table : 输出结不雅集的表
- type : 表示 mysql 在表中找到所需行的方法,或者叫拜访类型,常见类型机能由差到最好依次是:all、index、range、ref、eq_ref、const,system、null:
1. type=ALL,全表扫描,mysql 遍历全表来找到匹配的行:
- mysql> explain select * from film where rating > 9 \G
- *************************** 1. row ***************************
- id: 1
- select_type: SIMPLE
- table: film
- partitions: NULL
- type: ALL
- possible_keys: NULL
- key: NULL
- key_len: NULL
- ref: NULL
- rows: 1000
- filtered: 33.33
- Extra: Using where
- 1 row in set, 1 warning (0.01 sec)
2. type=index, 索引全扫描,mysql 遍历全部索引来萌芽匹配的行
- mysql> explain select title form film\G
- *************************** 1. row ***************************
- id: 1
推荐阅读
远胜微软谷歌等翻译器 | 基于神经网络和超级计算机的DeepL Translator
Microsoft Translator是微软旗下的翻译对象,痊愈客岁成功切换至神经网路。当时,微软表示比拟较今朝行业内主流的统计机械翻译(SMT)技巧,神经收集架构可以或许大年夜幅晋升翻译质量。德>>>详细阅读
本文标题:优化SQL语句的一般步骤
地址:http://www.17bianji.com/lsqh/37055.html
1/2 1