mysql中explain看性能
select distinct col_name from table where a=X and b=Y and date(time)='xx-xx-xx';
执行时间 27.9772 秒
explain select distinct col_name from table where a=X and b=Y and date(time)='xx-xx-xx';
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | SIMPLE | access | ALL | NULL | NULL | NULL | NULL | 38714243 | Using where; Using temporary |
select distinct col_name from table where a=X and b=Y and time<'xx-xx-xx';
执行时间 0.0038 秒
explain select distinct col_name from table where a=X and b=Y and time<'xx-xx-xx';
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | SIMPLE | access | range | idx_access_dt | idx_access_dt | 4 | NULL | 1 | Using where; Using temporary |
select distinct col_name from table where a=X and b=Y and time='xx-xx-xx xx:xx:xx';
执行时间 0.0031 秒
explain select distinct col_name from table where a=X and b=Y and time='xx-xx-xx xx:xx:xx';
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | SIMPLE | access | ref | idx_access_dt | idx_access_dt | 4 | const | 82 | Using where; Using temporary |
参考:
http://www.cnitblog.com/aliyiyi08/archive/2008/09/09/48878.html
mysql中explain看性能的更多相关文章
- mysql中explain的用法
mysql中explain的用法 最近在做性能测试中经常遇到一些数据库的问题,通常使用慢查询日志可以找到执行效果比较差的sql,但是仅仅找到这些sql是不行的,我们需要协助开发人员分析问题所在,这就经 ...
- mysql中影响数据库性能的因素讲解
mysql中影响数据库性能的因素讲解 在本篇文章中我们给大家讲述了mysql中影响性能的因素以及相关知识点内容,有兴趣的朋友参考下 关于数据库性能的故事 面试时多多少少会讲到数据库上的事情,“你对数据 ...
- 详解MySQL中EXPLAIN解释命令
Explain 结果解读与实践 基于 MySQL 5.0.67 ,存储引擎 MyISAM . 注:单独一行的"%%"及"`"表示分隔内容,就象分开“第一 ...
- MySQL中EXPLAIN解释命令详解
MySQL中的explain命令显示了mysql如何使用索引来处理select语句以及连接表.explain显示的信息可以帮助选择更好的索引和写出更优化的查询语句. 1.EXPLAIN的使用方法:在s ...
- MySQL中EXPLAIN解释命令 查看索引是否生效
explain显示了mysql如何使用索引来处理select语句以及连接表.可以帮助选择更好的索引和写出更优化的查询语句. 使用方法,在select语句前加上explain就可以了: 如: expla ...
- Mysql中explain命令查看语句执行概况
Mysql中可以使用explain命令查看查询语句的执行方式,使用方法举例:explain + 查询语句 例如:explain select * from user_info 几个重要的字段说明: t ...
- mysql中的SQL_CACHE(性能更优化)
mysql中的sql_cache是个容易忽视的地方,要 使用的话,必须先设置query_cache_size, 以及设置query_cache_type ,其中 query_cache_type 这个 ...
- MySQL中explain语句的使用
一.概述 在 MySQL 中,我们可以使用慢查询日志或者 show processlist 命令等方式定位到执行耗时较长的 SQL 语句,在这之后我们可以通过 EXPLAIN或者 DESC 命令获取 ...
- mysql中explain详解
explain语法 有两种用法: 1.EXPLAIN tbl_name 2.EXPLAIN [EXTENDED] SELECT select_options 为了更好的说明它,我们需要建两张表, ...
随机推荐
- ie浏览器的渲染原理
IE下载或者渲染顺序大致如下: IE下载的顺序是从上到下,渲染的顺序也是从上到下,下载和渲染是同时进行的. 在渲染到页面的某一部分时,其上面的所有部分都已经下载完成(但并不是说所有相关联的元素都已经下 ...
- SecureCRT自动记录日志【记录键入的所有命令和打印的结果信息】
- spring2.5整合hibernate3.0整合Struts
首先:这是spring framework+hibernate+struts集成,spring主要用于aop和ioc,hibernate主要是用于持久层,struts主要是用于mvc. 同时关于spr ...
- [HTMLDOM]删除已有的 HTML 元素
摘自www.w3school.com:http://www.w3school.com.cn/htmldom/dom_elements.asp如需删除 HTML 元素,您必须清楚该元素的父元素: < ...
- cf 61 E. Enemy is weak 离散化+树状数组
题意: 给出一个数组,数组的每一个元素都是不一样的,求出对于3个数组下标 i, j, k such that i < j < k and ai > aj > ak where ...
- python(15)提取字符串中的数字
python 提取一段字符串中去数字 ss = “123ab45” 方法一:filter filter(str.isdigit, ss) 别处copy的filter的用法: # one>> ...
- Logs
syslogs Fortinet: http://docs.fortinet.com/fgt.html
- iis7设置404页面不生效的原因
打开web.config <httpErrors errorMode="Custom" existingResponse="PassThrough"> ...
- 【JavaScript】JavaScript模拟Class
beauty("$Class",["$underscore"],function(_){ var Class = function () { var lengt ...
- docker一些命令
1.创建image(先创建Dockerfile) docker build -t xxx/xxx . 2.删除image docker rmi xxxxx(image id) docker rmi r ...