mysql5.6.16下跟踪SQL查询转换的结果_MySQL
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.16 |
+-----------+
1 row in set (0.00 sec)
mysql> create view v_test5 as select * from test1 order by index_length;
mysql> set session optimizer_trace='enabled=on';
mysql> select count(1) from v_test5 where index_length>1024 ;
mysql> select * from information_schema.optimizer_trace;
QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZ
{
"steps": [
{
"view": {
"database": "test",
"view": "v_test5",
"in_select#": 1,
"select#": 2,
"merged": true
}
},
{
"join_preparation": {
"select#": 1,
"steps": [
{
"expanded_query": "/* select#1 */ select count(1) AS `count(1)` from (`test1`) where (`test1`.`INDEX_LENGTH` > 1024) order by `test1`.`INDEX_LENGTH`"
}
]
}
},
{
"join_optimization": {
"select#": 1,
"steps": [
{
"transformations_to_nested_joins": {
"transformations": [
"parenthesis_removal"
],
"expanded_query": "/* select#1 */ select count(1) AS `count(1)` from `test1` where (`test1`.`INDEX_LENGTH` > 1024) order by `test1`.`INDEX_LENGTH`"
}
},
{
"condition_processing": {
"condition": "WHERE",
"original_condition": "(`test1`.`INDEX_LENGTH` > 1024)",
"steps": [
{
"transformation": "equality_propagation",
"resulting_condition": "(`test1`.`INDEX_LENGTH` > 1024)"
},
{
"transformation": "constant_propagation",
"resulting_condition": "(`test1`.`INDEX_LENGTH` > 1024)"
},
{
"transformation": "trivial_condition_removal",
"resulting_condition": "(`test1`.`INDEX_LENGTH` > 1024)"
}
]
}
},
{
"table_dependencies": [
{
"table": "`test1`",
"row_may_be_null": false,
"map_bit": 0,
"depends_on_map_bits": [
]
}
]
},
{
"ref_optimizer_key_uses": [
]
},
{
"rows_estimation": [
{
"table": "`test1`",
"table_scan": {
"rows": 166,
"cost": 4
}
}
]
},
{
"considered_execution_plans": [
{
"plan_prefix": [
],
"table": "`test1`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "scan",
"rows": 166,
"cost": 37.2,
"chosen": true
}
]
},
"cost_for_plan": 37.2,
"rows_for_plan": 166,
"chosen": true
}
]
},
{
"attaching_conditions_to_tables": {
"original_condition": "(`test1`.`INDEX_LENGTH` > 1024)",
"attached_conditions_computation": [
],
"attached_conditions_summary": [
{
"table": "`test1`",
"attached": "(`test1`.`INDEX_LENGTH` > 1024)"
}
]
}
},
{
"refine_plan": [
{
"table": "`test1`",
"access_type": "table_scan"
}
]
}
]
}
},
{
"join_execution": {
"select#": 1,
"steps": [
]
}
}
]
}
上一篇: 基于php的地图坐标服务接口调用代码实例
下一篇: 使用阿里大鱼短信发送验证码
推荐阅读
-
Mysql将查询结果集转换为JSON数据的实例代码
-
SQL一次性查询一个字段不同条件下的统计结果
-
SQL查询结果集对注入的影响及利用_MySQL
-
PHP将MySQL的查询结果转换为数组并用where拼接的示例_PHP
-
mysql查询时如果能用sql计算返回结果好,还是先返回结果再用php处理好,比如对字段转换大小写
-
mysql-MySQL 如何设计并查询某个结果的值,不同情况下查到另一个表的不同信息
-
PHP将MySQL的查询结果转换为数组并用where拼接的示例_PHP
-
关于对sql2000查询结果进行相关度排序的测试_MySQL
-
mysql查询时如果能用sql计算返回结果好,还是先返回结果再用php处理好,比如对字段转换大小写
-
php-[PHP] wamp环境下。使用PDO连接mysql,能执行查询的sql,不能调用存储过程