mysql中explain看性能
2015-01-09 20:46
85 查看
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';
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';
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';
参考:
http://www.cnitblog.com/aliyiyi08/archive/2008/09/09/48878.html
执行时间 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 |
执行时间 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 |
执行时间 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的使用
- MySQL性能分析及explain的使用
- MySQL性能分析及explain的使用
- MYSQL中对SQL性能分析方法 Explain 详细解释
- mysql-性能,命令-explain,show processlist,show
- MySQL性能分析及explain的使用
- MySQL性能分析及explain的使用说明
- MySQL性能分析及explain的使用
- mysql-性能,命令-explain,show processlist,show
- MySQL性能分析命令:Explain 详解
- mysql 性能分析及explain用法
- mysql:21个性能优化最佳实践之2[EXPLAIN 你的 SELECT 查询]
- MySQL性能分析及explain的使用说明
- MySQL性能优化---explain
- mysql 性能分析及explain用法
- Mysql_mysql 性能分析及explain用法
- MySQL性能分析及explain的使用