Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
explain select * from range_test where '2000-01-01 00:00:00' <= datetime_col and datetime_col <= '2075-01-01 00:00:00' | {
"steps": [
{
"join_preparation": {
"select#": 1,
"steps": [
{
"expanded_query": "/* select#1 */ select `range_test`.`id` AS `id`,`range_test`.`int_col` AS `int_col`,`range_test`.`bigint_col` AS `bigint_col`,`range_test`.`datetime_col` AS `datetime_col` from `range_test` where (('2000-01-01 00:00:00' <= `range_test`.`datetime_col`) and (`range_test`.`datetime_col` <= '2075-01-01 00:00:00'))"
}
]
}
},
{
"join_optimization": {
"select#": 1,
"steps": [
{
"condition_processing": {
"condition": "WHERE",
"original_condition": "(('2000-01-01 00:00:00' <= `range_test`.`datetime_col`) and (`range_test`.`datetime_col` <= '2075-01-01 00:00:00'))",
"steps": [
{
"transformation": "equality_propagation",
"resulting_condition": "(('2000-01-01 00:00:00' <= `range_test`.`datetime_col`) and (`range_test`.`datetime_col` <= '2075-01-01 00:00:00'))"
},
{
"transformation": "constant_propagation",
"resulting_condition": "(('2000-01-01 00:00:00' <= `range_test`.`datetime_col`) and (`range_test`.`datetime_col` <= '2075-01-01 00:00:00'))"
},
{
"transformation": "trivial_condition_removal",
"resulting_condition": "(('2000-01-01 00:00:00' <= `range_test`.`datetime_col`) and (`range_test`.`datetime_col` <= '2075-01-01 00:00:00'))"
}
]
}
},
{
"table_dependencies": [
{
"table": "`range_test`",
"row_may_be_null": false,
"map_bit": 0,
"depends_on_map_bits": [
]
}
]
},
{
"ref_optimizer_key_uses": [
]
},
{
"rows_estimation": [
{
"table": "`range_test`",
"range_analysis": {
"table_scan": {
"rows": 499060,
"cost": 101258
},
"potential_range_indices": [
{
"index": "PRIMARY",
"usable": false,
"cause": "not_applicable"
},
{
"index": "idx_int",
"usable": false,
"cause": "not_applicable"
},
{
"index": "idx_bigint",
"usable": false,
"cause": "not_applicable"
},
{
"index": "idx_datetime",
"usable": true,
"key_parts": [
"datetime_col",
"id"
]
}
],
"setup_range_conditions": [
],
"group_index_range": {
"chosen": false,
"cause": "not_group_by_or_distinct"
},
"analyzing_range_alternatives": {
"range_scan_alternatives": [
{
"index": "idx_datetime",
"ranges": [
"2000-01-01 00:00:00 <= datetime_col <= 2075-01-01 00:00:00"
],
"index_dives_for_eq_ranges": true,
"rowid_ordered": false,
"using_mrr": false,
"index_only": false,
"rows": 91028,
"cost": 109235,
"chosen": false,
"cause": "cost"
}
],
"analyzing_roworder_intersect": {
"usable": false,
"cause": "too_few_roworder_scans"
}
}
}
}
]
},
{
"considered_execution_plans": [
{
"plan_prefix": [
],
"table": "`range_test`",
"best_access_path": {
"considered_access_paths": [
{
"access_type": "scan",
"rows": 91028,
"cost": 101256,
"chosen": true
}
]
},
"cost_for_plan": 101256,
"rows_for_plan": 91028,
"chosen": true
}
]
},
{
"attaching_conditions_to_tables": {
"original_condition": "(('2000-01-01 00:00:00' <= `range_test`.`datetime_col`) and (`range_test`.`datetime_col` <= '2075-01-01 00:00:00'))",
"attached_conditions_computation": [
],
"attached_conditions_summary": [
{
"table": "`range_test`",
"attached": "(('2000-01-01 00:00:00' <= `range_test`.`datetime_col`) and (`range_test`.`datetime_col` <= '2075-01-01 00:00:00'))"
}
]
}
},
{
"refine_plan": [
{
"table": "`range_test`",
"access_type": "table_scan"
}
]
}
]
}
},
{
"join_explain": {
"select#": 1,
"steps": [
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment