<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 执行计划走索引的更多相关文章

  1. 【测试】使用hr用户下的employees表写一条SQL语句,执行计划走索引全扫描

    SQL> select count(*) from employees; COUNT(*) ---------- Execution Plan ------------------------- ...

  2. 如何根据执行计划,判断Mysql语句是否走索引

    如何根据执行计划,判断Mysql语句是否走索引

  3. Mysql 执行计划以及常见索引问题总结

    Mysql 执行计划以及常见索引问题总结

  4. MySQL 执行计划里的rows

    <pre name="code" class="html">SQL> alter session set statistics_level=a ...

  5. Mysql执行计划说明

    Mysql执行计划翻译: 官网原文请见http://dev.mysql.com/doc/refman/5.6/en/explain-output.html:5.6 EXPLAIN语句提供有关SELEC ...

  6. 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这四者的区别 ...

  7. 读懂MySQL执行计划

    原文:https://mp.weixin.qq.com/s/-BlLvBKcF-yalELY7XkqaQ 前言 在之前的面试过程中,问到执行计划,有很多童鞋不知道是什么?甚至将执行计划与执行时间认为是 ...

  8. MySQL 执行计划详解

    我们经常使用 MySQL 的执行计划来查看 SQL 语句的执行效率,接下来分析执行计划的各个显示内容. EXPLAIN SELECT * FROM users WHERE id IN (SELECT ...

  9. MySQL执行计划解读

    Explain语法 EXPLAIN SELECT …… 变体: 1. EXPLAIN EXTENDED SELECT …… 将执行计划“反编译”成SELECT语句,运行SHOW WARNINGS 可得 ...

随机推荐

  1. Main方法的执行过程(转)

    要运行一个 main 方法 , 首先要知道 main 方法所在的 Class, 在命令行中指定这个 Class 名 Class Lava{ Private int speed = 4; Void fl ...

  2. 基于visual Studio2013解决C语言竞赛题之0520相邻元素

          题目

  3. 【Demo 0025】注册/反注册窗体类RegisterClassEx/UnregisterClass

    所有窗体在创建前都必须注册窗体类,只有注册的窗体类才被系统认知并允许实例化,换句话说通过注册告诉进程窗体管理器此类窗体的属性如: 背景色,窗体上的鼠标样式以及窗体事件处理函数等;  有一些控件类系统自 ...

  4. 使用adb签名并安装Android程序

    首先需要准备Android SDK包,我是在windows上操作的,在PATH中配置  YOUT_SDK_PATH\android-sdk-windows\platform-tools 和  YOUT ...

  5. NanShan即时通讯论——HTML5的优势与劣势

    原文:NanShan即时通讯论--HTML5的优势与劣势 NanShan即时通讯 学习html时才是XHTML 1.0,接着是 HTML4.01,再到HTML5,如今HTML5 開始吸引越来越多的人的 ...

  6. C++自增和自减运算符(--和++)

    在C和C++中,常在表达式中使用自增(++)和自减(--)运算符,他们的作用是使变量的值增1或减1,如:++i(在使用i之前,先使i的值加1,如果i的原值为3,则执行j=++i后,j的值为4)--i ...

  7. 修改linux文件权限命令:chmod 【转载】

    Linux系统中的每个文件和目录都有访问许可权限,用它来确定谁可以通过何种方式对文件和目录进行访问和操作. chmod  命令可以改变所有子目录的权限,下面有2种方法 改变一个文件的权限: chmod ...

  8. Python之路Day3

    摘要: 复习day2内容 介绍set()-->归档到day2了... collections模块常用类 深浅copy的区别 自定义函数 文件操作 常用内建函数介绍 一.深浅copy的区别 #! ...

  9. Thread.sleep还是TimeUnit.SECONDS.sleep

    转http://stevex.blog.51cto.com/4300375/1285767/ 刚看到TimeUnit.SECONDS.sleep()方法时觉得挺奇怪的,这里怎么也提供sleep方法? ...

  10. 盘点:#AzureChat - 虚拟机和自动伸缩

    感谢大家跟 Corey Sanders 和 Stephen Siciliano 一起参加本次 #AzureChat.我们很高兴能借这次在线讨论的机会,倾听各位社区成员对我们最受欢迎的两个主题的意见 - ...