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看性能的更多相关文章

  1. mysql中explain的用法

    mysql中explain的用法 最近在做性能测试中经常遇到一些数据库的问题,通常使用慢查询日志可以找到执行效果比较差的sql,但是仅仅找到这些sql是不行的,我们需要协助开发人员分析问题所在,这就经 ...

  2. mysql中影响数据库性能的因素讲解

    mysql中影响数据库性能的因素讲解 在本篇文章中我们给大家讲述了mysql中影响性能的因素以及相关知识点内容,有兴趣的朋友参考下 关于数据库性能的故事 面试时多多少少会讲到数据库上的事情,“你对数据 ...

  3. 详解MySQL中EXPLAIN解释命令

    Explain 结果解读与实践   基于 MySQL 5.0.67 ,存储引擎 MyISAM .   注:单独一行的"%%"及"`"表示分隔内容,就象分开“第一 ...

  4. MySQL中EXPLAIN解释命令详解

    MySQL中的explain命令显示了mysql如何使用索引来处理select语句以及连接表.explain显示的信息可以帮助选择更好的索引和写出更优化的查询语句. 1.EXPLAIN的使用方法:在s ...

  5. MySQL中EXPLAIN解释命令 查看索引是否生效

    explain显示了mysql如何使用索引来处理select语句以及连接表.可以帮助选择更好的索引和写出更优化的查询语句. 使用方法,在select语句前加上explain就可以了: 如: expla ...

  6. Mysql中explain命令查看语句执行概况

    Mysql中可以使用explain命令查看查询语句的执行方式,使用方法举例:explain + 查询语句 例如:explain select * from user_info 几个重要的字段说明: t ...

  7. mysql中的SQL_CACHE(性能更优化)

    mysql中的sql_cache是个容易忽视的地方,要 使用的话,必须先设置query_cache_size, 以及设置query_cache_type ,其中 query_cache_type 这个 ...

  8. MySQL中explain语句的使用

    一.概述 在 MySQL 中,我们可以使用慢查询日志或者 show processlist 命令等方式定位到执行耗时较长的 SQL 语句,在这之后我们可以通过 EXPLAIN或者 DESC 命令获取 ...

  9. mysql中explain详解

    explain语法 有两种用法: 1.EXPLAIN tbl_name    2.EXPLAIN [EXTENDED] SELECT select_options 为了更好的说明它,我们需要建两张表, ...

随机推荐

  1. Softerra LDAP Browser 使用及配置 有图有真相

    Softerra LDAP Browser 4.5 我使用Softerra LDAP Browser的目的,是为了查找公司的人员信息.网上关于Softerra LDAP Browser配置太少了,所以 ...

  2. jquery .filter()过滤器

    述: 筛选元素集合中匹配表达式 或 通过传递函数测试的 那些元素集合. .filter( selector ) selector 类型: Selector                 一个用于匹配 ...

  3. 黄聪:wordpress自定义post_type,并且自定义固定链接

    <? class zsjh { function init() { add_action( 'init', array($this,'create_zsjh') ); add_filter('p ...

  4. Objective C SEl 和@selector是怎么工作的||How do SEL and @selector work in iphone sdk?

    SEL is a type that represents a selector in Objective-C. The @selector() keyword returns a SEL that ...

  5. 使用oschina的git服务器

    初始配置 用注册的用户名和邮箱配置git config,这个信息不一定是你在网站注册的内容. git config --global user.name "" git config ...

  6. 在win7电脑中如何查看运行进程的PID标识符

    在介绍技巧方法之前,咱们还是先来介绍一下什么是PID标识符,这个PID标识符就是系统对运行中的程序自动分配的一个编号,是用来识别对应进程的,而且这个编号也是一一对应,不会有重复的,只有当系统结束运行的 ...

  7. 配置webstorm使用supervisor时出现 /usr/bin/env: node: 没有那个文件或目录 解决方法

    配置好supervisor路径后 出现了 启动时出现了 /usr/bin/env: node: 没有那个文件或目录 需要讲.nvm下的node链接到, /usr/bin/目录下 sudo ln -s ...

  8. SQL Server 2005中的分区表(五):添加一个分区(转)

    所谓天下大事,分久必合,合久必分,对于分区表而言也一样.前面我们介绍过如何删除(合并)分区表中的一个分区,下面我们介绍一下如何为分区表添加一个分区. 为分区表添加一个分区,这种情况是时常会 发生的.比 ...

  9. WCF和WebService中获取当前请求报文的方法

    WCF中: 1. 在hosting WCF的web.config中加入: <system.serviceModel> <serviceHostingEnvironment aspNe ...

  10. [Java] 02 String的常用方法

    public class TestString{ public static void main(String[] args){ String str1 = "123"; Stri ...