160 lines
4.6 KiB
Plaintext
160 lines
4.6 KiB
Plaintext
SET optimizer_trace_max_mem_size=1048576;
|
|
SET @@session.optimizer_trace="enabled=on";
|
|
#
|
|
# BUG#18195373: OPTIMIZER TRACE SHOULD PRINT NAME OF
|
|
# INDEX FOR RANGE ACCESS
|
|
CREATE TABLE t1 (a VARCHAR(200), b TEXT, FULLTEXT (a,b));
|
|
INSERT INTO t1 VALUES('Testing how', 'full-text search'),
|
|
('is printed to the', 'optimizer trace.'),
|
|
('We need test coverage','of that too');
|
|
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("coverage");
|
|
a b
|
|
We need test coverage of that too
|
|
SELECT * FROM information_schema.OPTIMIZER_TRACE;
|
|
QUERY TRACE MISSING_BYTES_BEYOND_MAX_MEM_SIZE INSUFFICIENT_PRIVILEGES
|
|
SELECT * FROM t1 WHERE MATCH(a,b) AGAINST ("coverage") {
|
|
"steps": [
|
|
{
|
|
"join_preparation": {
|
|
"select#": 1,
|
|
"steps": [
|
|
{
|
|
"expanded_query": "/* select#1 */ select `t1`.`a` AS `a`,`t1`.`b` AS `b` from `t1` where (match `t1`.`a`,`t1`.`b` against ('coverage'))"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"join_optimization": {
|
|
"select#": 1,
|
|
"steps": [
|
|
{
|
|
"condition_processing": {
|
|
"condition": "WHERE",
|
|
"original_condition": "(match `t1`.`a`,`t1`.`b` against ('coverage'))",
|
|
"steps": [
|
|
{
|
|
"transformation": "equality_propagation",
|
|
"resulting_condition": "(match `t1`.`a`,`t1`.`b` against ('coverage'))"
|
|
},
|
|
{
|
|
"transformation": "constant_propagation",
|
|
"resulting_condition": "(match `t1`.`a`,`t1`.`b` against ('coverage'))"
|
|
},
|
|
{
|
|
"transformation": "trivial_condition_removal",
|
|
"resulting_condition": "(match `t1`.`a`,`t1`.`b` against ('coverage'))"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"substitute_generated_columns": {
|
|
}
|
|
},
|
|
{
|
|
"table_dependencies": [
|
|
{
|
|
"table": "`t1`",
|
|
"row_may_be_null": false,
|
|
"map_bit": 0,
|
|
"depends_on_map_bits": [
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"ref_optimizer_key_uses": [
|
|
{
|
|
"table": "`t1`",
|
|
"field": "<fulltext>",
|
|
"equals": "(match `t1`.`a`,`t1`.`b` against ('coverage'))",
|
|
"null_rejecting": false
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"rows_estimation": [
|
|
{
|
|
"table": "`t1`",
|
|
"table_scan": {
|
|
"rows": 3,
|
|
"cost": 0.5073
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"considered_execution_plans": [
|
|
{
|
|
"plan_prefix": [
|
|
],
|
|
"table": "`t1`",
|
|
"best_access_path": {
|
|
"considered_access_paths": [
|
|
{
|
|
"access_type": "fulltext",
|
|
"index": "a",
|
|
"rows": 1,
|
|
"cost": 0.35,
|
|
"chosen": true
|
|
},
|
|
{
|
|
"access_type": "scan",
|
|
"cost": 0.8073,
|
|
"rows": 3,
|
|
"chosen": false,
|
|
"cause": "cost"
|
|
}
|
|
]
|
|
},
|
|
"condition_filtering_pct": 100,
|
|
"rows_for_plan": 1,
|
|
"cost_for_plan": 0.35,
|
|
"chosen": true
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"attaching_conditions_to_tables": {
|
|
"original_condition": "(match `t1`.`a`,`t1`.`b` against ('coverage'))",
|
|
"attached_conditions_computation": [
|
|
],
|
|
"attached_conditions_summary": [
|
|
{
|
|
"table": "`t1`",
|
|
"attached": "(match `t1`.`a`,`t1`.`b` against ('coverage'))"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"finalizing_table_conditions": [
|
|
{
|
|
"table": "`t1`",
|
|
"original_table_condition": "(match `t1`.`a`,`t1`.`b` against ('coverage'))",
|
|
"final_table_condition ": "(match `t1`.`a`,`t1`.`b` against ('coverage'))"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"refine_plan": [
|
|
{
|
|
"table": "`t1`"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"join_execution": {
|
|
"select#": 1,
|
|
"steps": [
|
|
]
|
|
}
|
|
}
|
|
]
|
|
} 0 0
|
|
DROP TABLE t1;
|