<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. CURL基础

    下载单个文件: #下载单个文件,默认将输出打印到标准输出中(STDOUT)中curl http://www.centos.org # 将文件下载到本地并命名为mygettext.html curl - ...

  2. xadmin集成ueditor

    from DjangoUeditor.models import UEditorField content = UEditorField(u"内容", imagePath=&quo ...

  3. gradle项目与maven项目相互转化(转)

    根据build.gradle和setting.gradle文件生成idea项目: gradle idea gradle这几年发展迅猛,github越来越多的项目都开始采用gradle来构建了,但是并不 ...

  4. php下载远程图片方法总结(curl手动解析header)curl跳转问题解决

    常用方法一般有:. file_get_contents file_put_contents readfile($file) //效率很高. 一般代码: /** * 抓取远程图片 * * @param ...

  5. cmake 学习笔记(一)

    最大的Qt4程序群(KDE4)采用cmake作为构建系统 Qt4的python绑定(pyside)采用了cmake作为构建系统 开源的图像处理库 opencv 采用cmake 作为构建系统 ... 看 ...

  6. SRM 577 Div II Level Two: EllysRoomAssignmentsDiv2

    题目来源: http://community.topcoder.com/tc?module=ProblemDetail&rd=15497&pm=12521 这个问题要注意的就是只需要直 ...

  7. 07-IOSCore - CoreData补充、音频视频

    xml被plist取代了  数据库被coredata取代了 一.Core Data 高级补充 1. Core Data 本质是什么?操作数据库的数据 ORM Object Relationship M ...

  8. EditText 软键盘

    EditText 软键盘 package brother.eighteen.demoedittext; import android.content.Context; import android.t ...

  9. 在JavaScript中也玩变量类型强行转换

    <script language="javascript">     var str = '100';     var num = Number(100);     a ...

  10. C# MVC 自学笔记—5 添加模型

    ==============================翻译============================== 在本节中,您将添加一些类来管理数据库中的电影.这些类将 ASP.NET M ...