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 为了更好的说明它,我们需要建两张表, ...
随机推荐
- 【VB技巧】VB ListView 控件功能使用详解
来源:http://lcx.cc/?i=494 ListView控件 在工具箱上击鼠标右键,选择快捷菜单的Components(部件)项,在控件列表中选择Microsoft Windows Commo ...
- Redis内存使用优化与存储(转)
Redis常用数据类型 Redis最为常用的数据类型主要有以下五种: String Hash List Set Sorted set 在具体描述这几种数据类型之前,我们先通过一张图了解下Redis内部 ...
- JAVA类的构造方法
1,构造方法没有返回类型, 定义: []public] 方法名() {} 2,一个构造方法如果想调用同一类中的另一个构造方法,只能调用一个,并且要放在构造方法第一行 3,用this调用,如 publi ...
- A note to "On global motions of a compressible barotropic and selfgravitating gas with density-dependent viscosities"
Ducomet, Bernard; Nečasová, Šárka; Vasseur, Alexis. On global motions of a compressible barotropic a ...
- SteamVR Unity工具包(VRTK)之概览和控制器事件
快速上手 · 克隆仓库 git clone https://github.com/thestonefox/SteamVR_Unity_Toolkit.git · 用Unity3d打开SteamVR_ ...
- JAVA 方法重载
方法的重载是指:一个类中可以定义有相同的名字,但参数不同的多个方法,调用时会根据不同的参数列表选择对应的方法. 实例: W.java public class W{ public void F(Str ...
- mongodb 数据导入导出
mongoexport 命令异常方便简单强大! 连接数据库: jkmiao@jkmiao-ipin:~$ mongo 192.168.1.xx:xxx/jd_58tc_raw 1. 导出10条数据到 ...
- webim-界面细节调整
1)左侧css调整 3)界面和滚动条美化 8)界面
- Ubuntu下启动Apache的Rewrite功能
在终端中执行 sudo a2enmod rewrite 指令后,即启用了 Mod_rewrite 模块. 另外,也可以通过将 /etc/apache2/mods-available/rewrite.l ...
- 无侵入方面编程-用HttpModule+SoapExtension监视页面执行参数(一)
先简单介绍一下项目吧,我们这个项目是用VS2003开发的,老早一个项目.WEB前端机+业务处理(WebService层)+数据库分别布置在不同的计算机上. 现在老总有一个需求,要统计出每个页面的执行时 ...