Query time 0.00095
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "55.46"
},
"grouping_operation": {
"using_temporary_table": true,
"using_filesort": false,
"nested_loop": [
{
"table": {
"table_name": "cscart_discussion",
"access_type": "range",
"possible_keys": [
"object_id"
],
"key": "object_id",
"used_key_parts": [
"object_id",
"object_type"
],
"key_length": "6",
"rows_examined_per_scan": 48,
"rows_produced_per_join": 48,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (97994,97995,97996,97997,97998,97999,98000,98024,98025,98026,98027,98028,98029,98457,98458,98459,98460,98461,98462,98463,98464,98465,98466,98467,98468,98469,98470,98471,98472,98473,98474,98475,98496,98497,98498,98499,98500,98501,98515,98521,98522,99026,99027,99028,99029,99030,99031,99032)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "28.81",
"eval_cost": "4.80",
"prefix_cost": "33.61",
"data_read_per_join": "1K"
},
"used_columns": [
"thread_id",
"object_id",
"object_type",
"type"
]
}
},
{
"table": {
"table_name": "cscart_discussion_posts",
"access_type": "ref",
"possible_keys": [
"thread_id",
"thread_id_2"
],
"key": "thread_id",
"used_key_parts": [
"thread_id"
],
"key_length": "3",
"ref": [
"nuie_scalesta_net.cscart_discussion.thread_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 48,
"filtered": "100.00",
"cost_info": {
"read_cost": "12.00",
"eval_cost": "4.80",
"prefix_cost": "50.41",
"data_read_per_join": "21K"
},
"used_columns": [
"post_id",
"thread_id",
"status"
],
"attached_condition": "<if>(is_not_null_compl(cscart_discussion_posts), (`nuie_scalesta_net`.`cscart_discussion_posts`.`status` = 'A'), true)"
}
},
{
"table": {
"table_name": "cscart_discussion_rating",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"thread_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 48,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "4.80",
"prefix_cost": "55.46",
"data_read_per_join": "768"
},
"used_columns": [
"rating_value",
"post_id",
"thread_id"
],
"attached_condition": "<if>(is_not_null_compl(cscart_discussion_rating), ((`nuie_scalesta_net`.`cscart_discussion_rating`.`post_id` = `nuie_scalesta_net`.`cscart_discussion_posts`.`post_id`) and (`nuie_scalesta_net`.`cscart_discussion_rating`.`thread_id` = `nuie_scalesta_net`.`cscart_discussion`.`thread_id`) and (`nuie_scalesta_net`.`cscart_discussion_rating`.`rating_value` <> 0)), true)"
}
}
]
}
}
}
Result
| product_id |
average_rating |
discussion_type |
discussion_thread_id |
| 97994 |
|
B |
106175 |
| 97995 |
|
B |
106176 |
| 97996 |
|
B |
106177 |
| 97997 |
|
B |
106178 |
| 97998 |
|
B |
106179 |
| 97999 |
|
B |
106180 |
| 98000 |
|
B |
106181 |
| 98024 |
|
B |
106205 |
| 98025 |
|
B |
106206 |
| 98026 |
|
B |
106207 |
| 98027 |
|
B |
106208 |
| 98028 |
|
B |
106209 |
| 98029 |
|
B |
106210 |
| 98457 |
|
B |
106638 |
| 98458 |
|
B |
106639 |
| 98459 |
|
B |
106640 |
| 98460 |
|
B |
106641 |
| 98461 |
|
B |
106642 |
| 98462 |
|
B |
106643 |
| 98463 |
|
B |
106644 |
| 98464 |
|
B |
106645 |
| 98465 |
|
B |
106646 |
| 98466 |
|
B |
106647 |
| 98467 |
|
B |
106648 |
| 98468 |
|
B |
106649 |
| 98469 |
|
B |
106650 |
| 98470 |
|
B |
106651 |
| 98471 |
|
B |
106652 |
| 98472 |
|
B |
106653 |
| 98473 |
|
B |
106654 |
| 98474 |
|
B |
106655 |
| 98475 |
|
B |
106656 |
| 98496 |
|
B |
106677 |
| 98497 |
|
B |
106678 |
| 98498 |
|
B |
106679 |
| 98499 |
|
B |
106680 |
| 98500 |
|
B |
106681 |
| 98501 |
|
B |
106682 |
| 98515 |
|
B |
106696 |
| 98521 |
|
B |
106702 |
| 98522 |
|
B |
106703 |
| 99026 |
|
B |
107207 |
| 99027 |
|
B |
107208 |
| 99028 |
|
B |
107209 |
| 99029 |
|
B |
107210 |
| 99030 |
|
B |
107211 |
| 99031 |
|
B |
107212 |
| 99032 |
|
B |
107213 |