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. Env:Winmanager插件使用

    转自:http://www.cnblogs.com/feichexia/archive/2012/11/06/vim_WinManager.html 1.准备winmanger插件,从下面网址下即可: ...

  2. Segment fault及LINUX core dump详解 (zz)

    C 程序在进行中发生segment fault(core dump)错误,通常与内存操作不当有关,主要有以下几种情况: (1)数组越界. (2)修改了只读内存. (3)scanf("%d&q ...

  3. POJ 2195 Going Home 最小费用流 裸题

    给出一个n*m的图,其中m是人,H是房子,.是空地,满足人的个数等于房子数. 现在让每个人都选择一个房子住,每个人只能住一间,每一间只能住一个人. 每个人可以向4个方向移动,每移动一步需要1$,问所有 ...

  4. python(14)类,方法,对象,实例

    类: 简单来说就是一个函数的集合,在这个集合里面你定义了很多个函数: 方法:其实就是你定义的这些函数. 对象:简单来说就是自身具有多个属性(也可以说是子变量)的变量而已. 在下面的例子中class P ...

  5. bug_ _ java.lang.IllegalArgumentException: pointerIndex out of range 问题的两种解决办法

    ========== 4     如何解决java.lang.IllegalArgumentException: pointerIndex out of range? 今天遇到一个bug:java.l ...

  6. Eclipse "IOConsole updater" has encounter a problem

    因为调试方便,把eclipse里的控制台输出调整为无限制了,结果各种log打了一夜居然把堆内存打爆了. 还是改回去吧. 在日志输出的状态下(貌似没日志的时候没法选)右键console的内容区域 -&g ...

  7. ubuntu网络配置相关知识(转载)

    From:http://os.51cto.com/art/201003/188055.htm 文章主要介绍Ubuntu网络配置,希望能让Linux新手学习参考.更好使用Ubuntu.更有效的学习Ubu ...

  8. [Java] 对象排序示例

    package test.collections; import java.util.ArrayList; import java.util.Collection; import java.util. ...

  9. 让我苦苦寻找的那段代码---springmvc的ajax前后台交互

    导入jar包: web.xml <servlet> <servlet-name>spmvc</servlet-name> <servlet-class> ...

  10. easyui tabs内容panel自适应窗体宽度方法

    废话不说,直接上代码: $('#Teacherwin_details').window({ title: '查看教职工信息', width: 800, height: 520, top: ($(win ...