mysql 执行计划走索引
<pre name="code" class="html">mysql> desc AssignClientManager;
+-----------------+----------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+----------+------+-----+---------+----------------+
| sn | int(11) | NO | PRI | NULL | auto_increment |
| clientSn | int(11) | NO | MUL | NULL | |
| clientManagerSn | int(11) | NO | | NULL | |
| status | char(1) | NO | | 1 | |
| createdTime | datetime | YES | | NULL | |
| updatedTime | datetime | YES | | NULL | |
+-----------------+----------+------+-----+---------+----------------+
6 rows in set (0.00 sec) mysql> show index from AssignClientManager;
+---------------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+---------------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| AssignClientManager | 0 | PRIMARY | 1 | sn | A | 4934 | NULL | NULL | | BTREE | | |
| AssignClientManager | 1 | ACM_IDX1 | 1 | clientSn | A | 4458 | NULL | NULL | | BTREE | | |
+---------------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
2 rows in set (0.00 sec) mysql> explian select sn,clientSn from AssignClientManager;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'explian select sn,clientSn from AssignClientManager' at line 1
mysql> explain select sn,clientSn from AssignClientManager;
+----+-------------+---------------------+------------+-------+---------------+----------+---------+------+------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+---------------------+------------+-------+---------------+----------+---------+------+------+----------+-------------+
| 1 | SIMPLE | AssignClientManager | NULL | index | NULL | ACM_IDX1 | 4 | NULL | 4934 | 100.00 | Using index |
+----+-------------+---------------------+------------+-------+---------------+----------+---------+------+------+----------+-------------+
1 row in set, 1 warning (0.00 sec) mysql> explain SELECT COUNT(sn) FROM AssignClientManager where clientSn>5;
+----+-------------+---------------------+------------+-------+---------------+----------+---------+------+------+----------+--------------------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+---------------------+------------+-------+---------------+----------+---------+------+------+----------+--------------------------+
| 1 | SIMPLE | AssignClientManager | NULL | range | ACM_IDX1 | ACM_IDX1 | 4 | NULL | 4928 | 100.00 | Using where; Using index |
+----+-------------+---------------------+------------+-------+---------------+----------+---------+------+------+----------+--------------------------+
1 row in set, 1 warning (0.00 sec) mysql> explain select * from AssignClientManager where sn <100 and clientSn <200;
+----+-------------+---------------------+------------+-------+------------------+---------+---------+------+------+----------+-------------+
| id | select_type | table | partitions | type | possible_keys | key | key_len | ref | rows | filtered | Extra |
+----+-------------+---------------------+------------+-------+------------------+---------+---------+------+------+----------+-------------+
| 1 | SIMPLE | AssignClientManager | NULL | range | PRIMARY,ACM_IDX1 | PRIMARY | 4 | NULL | 99 | 4.95 | Using where |
+----+-------------+---------------------+------------+-------+------------------+---------+---------+------+------+----------+-------------+
1 row in set, 1 warning (0.01 sec)
mysql 执行计划走索引的更多相关文章
- 【测试】使用hr用户下的employees表写一条SQL语句,执行计划走索引全扫描
SQL> select count(*) from employees; COUNT(*) ---------- Execution Plan ------------------------- ...
- 如何根据执行计划,判断Mysql语句是否走索引
如何根据执行计划,判断Mysql语句是否走索引
- Mysql 执行计划以及常见索引问题总结
Mysql 执行计划以及常见索引问题总结
- MySQL 执行计划里的rows
<pre name="code" class="html">SQL> alter session set statistics_level=a ...
- Mysql执行计划说明
Mysql执行计划翻译: 官网原文请见http://dev.mysql.com/doc/refman/5.6/en/explain-output.html:5.6 EXPLAIN语句提供有关SELEC ...
- MySQL 执行计划中Extra(Using where,Using index,Using index condition,Using index,Using where)的浅析
关于如何理解MySQL执行计划中Extra列的Using where.Using Index.Using index condition,Using index,Using where这四者的区别 ...
- 读懂MySQL执行计划
原文:https://mp.weixin.qq.com/s/-BlLvBKcF-yalELY7XkqaQ 前言 在之前的面试过程中,问到执行计划,有很多童鞋不知道是什么?甚至将执行计划与执行时间认为是 ...
- MySQL 执行计划详解
我们经常使用 MySQL 的执行计划来查看 SQL 语句的执行效率,接下来分析执行计划的各个显示内容. EXPLAIN SELECT * FROM users WHERE id IN (SELECT ...
- MySQL执行计划解读
Explain语法 EXPLAIN SELECT …… 变体: 1. EXPLAIN EXTENDED SELECT …… 将执行计划“反编译”成SELECT语句,运行SHOW WARNINGS 可得 ...
随机推荐
- Python之路Day10
本节主要内容:memcache&redis.RabbitMQ.twisted框架 1. memcache&redis 1.1 memcache Memcached 是一个高性能的分布式 ...
- Executor框架
Executor框架是指java5中引入的一系列并发库中与executor相关的功能类,包括Executor.Executors.ExecutorService.CompletionService. ...
- zabbix 添加主机成功失败判断
zabbix 成功添加后: $VAR1 = bless( { 'version' => 0, 'content' => { 'jsonrpc' => '2.0', 'id' => ...
- HDU 4740 模拟题意
九野的博客,转载请注明出处:http://blog.csdn.net/acmmmm/article/details/11711743 题意:驴和老虎在方格中跑,跑的方式:径直跑,若遇到边界或之前走过的 ...
- host字段变复杂了
声明: 本博客欢迎转载,但请保留原作者信息! 作者:李人可 团队:华为杭州OpenStack团队 讨论的是openstack中卷的host属性. 印象中.社区H版本号对于volume的host值表示的 ...
- CF#213DIV2:B The Fibonacci Segment
You have array a1, a2, ..., an. Segment [l, r] (1 ≤ l ≤ r ≤ n) is good if ai = ai - 1 + ai - 2, for ...
- 使用VS+VisualGDB编译Linux版本RCF(相当于Linux也有COM版本了)
阅读目录 通过向导配置项目 配置目录结构 修改项目配置 添加RCF源代码 完成配置并进行编译 添加测试程序 添加测试代码——通过TCP进行通信 运行测试程序并查看测试结果 VisualGDB生成的所有 ...
- asp.net 生成、解析条形码和二维码
原文 asp.net 生成.解析条形码和二维码 一.条形码 一维码,俗称条形码,广泛的用于电子工业等行业.比如我们常见的书籍背面就会有条形码,通过扫描枪等设备扫描就可以获得书籍的ISBN(Intern ...
- c++ 中CImage类Load函数,路径中含有空格应对策略!
最近,在写一些东西的时候,需要用到CImage类将JPG各式的图片转换成BMP图片,传入的是图片的绝对地址:如C:\Users\Administrator\Documents\Visual Studi ...
- [HTML5实现人工智能]小游戏《井字棋》发布,据说IQ上200才能赢
一,什么是TicTacToe(井字棋) 本 游戏 为在下用lufylegend开发的第二款小游戏.此游戏是大家想必大家小时候都玩过,因为玩它很简单,只需要一张草稿纸和一只笔就能开始游戏,所以广受儿 ...