Query time 0.00088
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "34.76"
},
"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": 30,
"rows_produced_per_join": 30,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (94936,94937,94938,94939,94940,94941,94942,94943,94944,94945,94946,94947,94948,94949,95100,95558,95559,95560,95638,95640,95645,95646,95653,95790,95932,95933,95936,95940,96245,96246)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "18.01",
"eval_cost": "3.00",
"prefix_cost": "21.01",
"data_read_per_join": "720"
},
"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": 30,
"filtered": "100.00",
"cost_info": {
"read_cost": "7.50",
"eval_cost": "3.00",
"prefix_cost": "31.51",
"data_read_per_join": "13K"
},
"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": 30,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "3.00",
"prefix_cost": "34.76",
"data_read_per_join": "480"
},
"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 |
| 94936 |
|
B |
103108 |
| 94937 |
|
B |
103109 |
| 94938 |
|
B |
103110 |
| 94939 |
|
B |
103111 |
| 94940 |
|
B |
103112 |
| 94941 |
|
B |
103113 |
| 94942 |
|
B |
103114 |
| 94943 |
|
B |
103115 |
| 94944 |
|
B |
103116 |
| 94945 |
|
B |
103117 |
| 94946 |
|
B |
103118 |
| 94947 |
|
B |
103119 |
| 94948 |
|
B |
103120 |
| 94949 |
|
B |
103121 |
| 95100 |
|
B |
103272 |
| 95558 |
|
B |
103730 |
| 95559 |
|
B |
103731 |
| 95560 |
|
B |
103732 |
| 95638 |
|
B |
103810 |
| 95640 |
|
B |
103812 |
| 95645 |
|
B |
103817 |
| 95646 |
|
B |
103818 |
| 95653 |
|
B |
103825 |
| 95790 |
|
B |
103962 |
| 95932 |
|
B |
104104 |
| 95933 |
|
B |
104105 |
| 95936 |
|
B |
104108 |
| 95940 |
|
B |
104112 |
| 96245 |
|
B |
104417 |
| 96246 |
|
B |
104418 |