@
shenjinpeng @
huntcool001 ``` json
{
"version": "json",
"signature": "MySQL Connector Java",
"date": "2020-09-28T13:58:48.103781",
"sql": "select\r\n\t\tv.OrganizationId, v.Vin, v.LicensePlateNo,s.*\tfrom\r\n\t\tvehicle `v`\r\n\tjoin trip `s` on\r\n\t\t`s`.`Vin` \u003d `v`.`Vin`\r\n\twhere\r\n\t\tv.dr \u003d 0\r\n\t\t and v.OrganizationId between 10000000000000000 and 19999999999999999\r\norder by\r\n\tEndTime desc\r\nlimit 0,\r\n10",
"root": [
{
"name": "",
"kind": "Node",
"type": "select",
"cond": "",
"desc": "",
"attributes": {
"select_id": "1",
"query_cost": "3808.72"
},
"child": [
{
"name": "",
"kind": "Node",
"type": "ordering_operation",
"cond": "",
"desc": "",
"attributes": {
"using_temporary_table": "true",
"using_filesort": "true",
"sort_cost": "1684.78"
},
"child": [
{
"name": "",
"kind": "Node",
"type": "nested_loop#1",
"cond": "",
"desc": "",
"attributes": {},
"child": [
{
"name": "v (index)",
"kind": "Node",
"type": "table",
"cond": "",
"desc": "",
"attributes": {
"table_name": "v",
"access_type": "index",
"possible_keys": "[\"vehicle_vin_IDX\"]",
"key": "vehicle_vin_IDX",
"used_key_parts": "[\"vin\",\"Dr\",\"OrganizationId\",\"LicensePlateNo\"]",
"key_length": "259",
"rows_examined_per_scan": "471",
"rows_produced_per_join": "5",
"filtered": "1.11",
"using_index": "true",
"read_cost": "101.15",
"eval_cost": "1.05",
"prefix_cost": "102.20",
"data_read_per_join": "7K",
"used_columns": "[\"Id\",\"Dr\",\"OrganizationId\",\"LicensePlateNo\",\"vin\"]",
"attached_condition": "(((`v`.`Dr` \u003d 0) and (`v`.`OrganizationId` between 10000000000000000 and 19999999999999999)) and (`v`.`vin` is not null))"
}
}
]
},
{
"name": "",
"kind": "Node",
"type": "nested_loop#2",
"cond": "",
"desc": "",
"attributes": {},
"child": [
{
"name": "s (ref)",
"kind": "Node",
"type": "table",
"cond": "",
"desc": "",
"attributes": {
"table_name": "s",
"access_type": "ref",
"possible_keys": "[\"trip_Vin_IDX\"]",
"key": "trip_Vin_IDX",
"used_key_parts": "[\"Vin\"]",
"key_length": "202",
"ref": "[\"orgidchange.v.vin\"]",
"rows_examined_per_scan": "321",
"rows_produced_per_join": "1684",
"filtered": "100.00",
"read_cost": "1684.78",
"eval_cost": "336.96",
"prefix_cost": "2123.94",
"data_read_per_join": "3M",
"used_columns": "[\"Id\",\"Vin\",\"LicensePlateNo\",\"20 个其他字段\"]"
}
}
]
}
]
}
]
}
]
}
```
上面是 dbeaver 导出的执行计划,可能更详细点,自带的 explain 表格搞了半天格式都会乱,好难用,mysql 版本是 5.7,没有 explain ANALYZE