Query time 0.00172
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "96.09"
},
"ordering_operation": {
"using_filesort": true,
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": false,
"nested_loop": [
{
"table": {
"table_name": "PC",
"access_type": "ref",
"possible_keys": [
"PRIMARY",
"link_type",
"pt",
"idx_pc_product_id_type"
],
"key": "link_type",
"used_key_parts": [
"link_type",
"category_id"
],
"key_length": "6",
"ref": [
"const",
"const"
],
"rows_examined_per_scan": 64,
"rows_produced_per_join": 64,
"filtered": "100.00",
"using_index": true,
"cost_info": {
"read_cost": "0.27",
"eval_cost": "6.40",
"prefix_cost": "6.67",
"data_read_per_join": "1024"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
},
{
"table": {
"table_name": "P",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"status",
"cscart_products_brand_id_index",
"cscart_products_product_id_index",
"idx_status"
],
"key": "PRIMARY",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"ref": [
"dev2.PC.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 46,
"filtered": "72.23",
"cost_info": {
"read_cost": "16.00",
"eval_cost": "4.62",
"prefix_cost": "29.07",
"data_read_per_join": "348K"
},
"used_columns": [
"product_id",
"status",
"brand_id"
],
"attached_condition": "((`dev2`.`P`.`status` = 'A') and (`dev2`.`P`.`brand_id` is not null))"
}
},
{
"table": {
"table_name": "B",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"cscart_brands_pk2"
],
"key": "PRIMARY",
"used_key_parts": [
"brand_id"
],
"key_length": "4",
"ref": [
"dev2.P.brand_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 46,
"filtered": "100.00",
"cost_info": {
"read_cost": "11.56",
"eval_cost": "4.62",
"prefix_cost": "45.25",
"data_read_per_join": "158K"
},
"used_columns": [
"brand_id",
"brand"
]
}
},
{
"table": {
"table_name": "BR",
"access_type": "eq_ref",
"possible_keys": [
"unique_brand_category",
"idx_br_brand_category"
],
"key": "unique_brand_category",
"used_key_parts": [
"brand_id",
"category_id"
],
"key_length": "8",
"ref": [
"dev2.P.brand_id",
"const"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 46,
"filtered": "100.00",
"cost_info": {
"read_cost": "46.22",
"eval_cost": "4.62",
"prefix_cost": "96.09",
"data_read_per_join": "1K"
},
"used_columns": [
"id",
"brand_id",
"category_id",
"current_position"
],
"attached_condition": "<if>(is_not_null_compl(BR), (`dev2`.`BR`.`current_position` > 0), true)"
}
}
]
}
}
}
}
Result
brand_id |
brand |
current_position |
category_id |
3060 |
ANKAI |
|
559 |
627 |
FOTON |
|
559 |
3062 |
HIGER |
|
559 |
3061 |
KING LONG |
|
559 |
2143 |
YUTONG |
|
559 |
3063 |
ZHONG TONG |
|
559 |
3174 |
ПАЗ |
|
559 |