Query time 0.00129
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "72.73"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "8.48"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 40,
"rows_produced_per_join": 1,
"filtered": "4.00",
"cost_info": {
"read_cost": "4.54",
"eval_cost": "0.16",
"prefix_cost": "4.70",
"data_read_per_join": "6K"
},
"used_columns": [
"category_id",
"storefront_id",
"usergroup_ids",
"status"
],
"attached_condition": "((`gaseus`.`cscart_categories`.`storefront_id` in (0,1)) and ((`gaseus`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`gaseus`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`gaseus`.`cscart_categories`.`usergroup_ids`))) and (`gaseus`.`cscart_categories`.`status` in ('A','H')))"
}
},
{
"table": {
"table_name": "cscart_products_categories",
"access_type": "range",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "pt",
"used_key_parts": [
"product_id"
],
"key_length": "3",
"rows_examined_per_scan": 53,
"rows_produced_per_join": 8,
"filtered": "10.00",
"index_condition": "(`gaseus`.`cscart_products_categories`.`product_id` in (5592,5593,5594,5595,5596,5597,5598,5599,5600,5601,5602,5603,5604,5605,5606,5607,5608,5609,5610,5611,5612,1423,1424,1425,1426,1427,5136,5137,5138,5139,5140,5141,6711,1455,5164,1445,5154,1456,5165,1446,5155,1458,5167,1448,5157,1459,5168,5158))",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "48.90",
"eval_cost": "0.85",
"prefix_cost": "62.08",
"data_read_per_join": "135"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
],
"attached_condition": "(`gaseus`.`cscart_products_categories`.`category_id` = `gaseus`.`cscart_categories`.`category_id`)"
}
},
{
"table": {
"table_name": "product_position_source",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id",
"product_id"
],
"key_length": "6",
"ref": [
"const",
"gaseus.cscart_products_categories.product_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 8,
"filtered": "100.00",
"cost_info": {
"read_cost": "1.33",
"eval_cost": "0.85",
"prefix_cost": "64.25",
"data_read_per_join": "135"
},
"used_columns": [
"product_id",
"category_id",
"position"
]
}
}
]
}
}
}
Result
| product_id |
category_ids |
position |
| 1423 |
308M |
0 |
| 1424 |
308M |
0 |
| 1425 |
308M |
0 |
| 1426 |
308M |
0 |
| 1427 |
308M |
0 |
| 1445 |
308M |
0 |
| 1446 |
308M |
0 |
| 1448 |
308M |
0 |
| 1455 |
308M |
0 |
| 1456 |
308M |
0 |
| 1458 |
308M |
0 |
| 1459 |
308M |
0 |
| 5136 |
308M |
0 |
| 5137 |
308M |
0 |
| 5138 |
308M |
0 |
| 5139 |
308M |
0 |
| 5140 |
308M |
0 |
| 5141 |
308M |
0 |
| 5154 |
308M |
0 |
| 5155 |
308M |
0 |
| 5157 |
308M |
0 |
| 5158 |
308M |
0 |
| 5164 |
308M |
0 |
| 5165 |
308M |
0 |
| 5167 |
308M |
0 |
| 5168 |
308M |
0 |
| 5592 |
308M |
0 |
| 5593 |
308M |
0 |
| 5594 |
308M |
0 |
| 5595 |
308M |
0 |
| 5596 |
308M |
0 |
| 5597 |
308M |
0 |
| 5598 |
308M |
0 |
| 5599 |
308M |
0 |
| 5600 |
308M |
0 |
| 5601 |
308M |
0 |
| 5602 |
308M |
0 |
| 5603 |
308M |
0 |
| 5604 |
308M |
0 |
| 5605 |
308M |
0 |
| 5606 |
308M |
0 |
| 5607 |
308M |
0 |
| 5608 |
308M |
0 |
| 5609 |
308M |
0 |
| 5610 |
308M |
0 |
| 5611 |
308M |
0 |
| 5612 |
308M |
0 |
| 6711 |
308M |
0 |