Query time 0.00085
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "42.19"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": true,
"cost_info": {
"sort_cost": "1.47"
},
"nested_loop": [
{
"table": {
"table_name": "cscart_categories",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"c_status",
"p_category_id"
],
"rows_examined_per_scan": 98,
"rows_produced_per_join": 3,
"filtered": "4.00",
"cost_info": {
"read_cost": "22.50",
"eval_cost": "0.78",
"prefix_cost": "23.28",
"data_read_per_join": "13K"
},
"used_columns": [
"category_id",
"storefront_id",
"usergroup_ids",
"status"
],
"attached_condition": "((`danishecarter_latest`.`cscart_categories`.`storefront_id` in (0,1)) and ((`danishecarter_latest`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`danishecarter_latest`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`danishecarter_latest`.`cscart_categories`.`usergroup_ids`)) and (`danishecarter_latest`.`cscart_categories`.`status` in ('A','H')))"
}
},
{
"table": {
"table_name": "cscart_products_categories",
"access_type": "ref",
"possible_keys": [
"PRIMARY",
"pt"
],
"key": "PRIMARY",
"used_key_parts": [
"category_id"
],
"key_length": "3",
"ref": [
"danishecarter_latest.cscart_categories.category_id"
],
"rows_examined_per_scan": 3,
"rows_produced_per_join": 1,
"filtered": "12.47",
"index_condition": "(`danishecarter_latest`.`cscart_products_categories`.`product_id` in (423,424,455,433,495,453,468,467,420,421,422,437,494,454,442,426,429,428,438,440,443,463,460,450,446,447,476,457,482,483,472,441,485,492,479,480,449,474,473,448,493,456,469,431,466,439,484,470))",
"cost_info": {
"read_cost": "15.09",
"eval_cost": "0.29",
"prefix_cost": "40.73",
"data_read_per_join": "23"
},
"used_columns": [
"product_id",
"category_id",
"link_type"
]
}
}
]
}
}
}
Result
product_id |
category_ids |
420 |
296M |
421 |
296M |
422 |
296M |
423 |
296M |
424 |
296M |
426 |
303M |
428 |
303M |
429 |
303M |
431 |
303M |
433 |
296M |
437 |
306M |
438 |
301M |
439 |
305M |
440 |
301M |
441 |
296M |
442 |
305M |
443 |
295M |
446 |
305M |
447 |
305M |
448 |
303M |
449 |
305M |
450 |
303M |
453 |
304M |
454 |
305M |
455 |
297M |
456 |
303M |
457 |
305M |
460 |
304M |
463 |
304M |
466 |
303M |
467 |
302M |
468 |
302M |
469 |
305M |
470 |
303M |
472 |
302M |
473 |
303M |
474 |
303M |
476 |
305M |
479 |
302M |
480 |
302M |
482 |
306M |
483 |
305M |
484 |
303M |
485 |
302M |
492 |
302M |
493 |
303M |
494 |
296M |
495 |
296M |