Query time 0.00112
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 (94693,94710,94711,94712,94713,94714,94715,94716,96302,96303,96711,96712,96713,96714,96716,96721,96722,96723,96725,96728,96729,96730,96731,96736,96737,96750,96752,96753,96754,96755,96767,96768,96769,96770,96788,97011,97012,97013,97014,97018,97019,97020,97021,97034,97035,97036,97037,97038)) 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 |
| 94693 |
|
B |
102865 |
| 94710 |
|
B |
102882 |
| 94711 |
|
B |
102883 |
| 94712 |
|
B |
102884 |
| 94713 |
|
B |
102885 |
| 94714 |
|
B |
102886 |
| 94715 |
|
B |
102887 |
| 94716 |
|
B |
102888 |
| 96302 |
|
B |
104474 |
| 96303 |
|
B |
104475 |
| 96711 |
|
B |
104892 |
| 96712 |
|
B |
104893 |
| 96713 |
|
B |
104894 |
| 96714 |
|
B |
104895 |
| 96716 |
|
B |
104897 |
| 96721 |
|
B |
104902 |
| 96722 |
|
B |
104903 |
| 96723 |
|
B |
104904 |
| 96725 |
|
B |
104906 |
| 96728 |
|
B |
104909 |
| 96729 |
|
B |
104910 |
| 96730 |
|
B |
104911 |
| 96731 |
|
B |
104912 |
| 96736 |
|
B |
104917 |
| 96737 |
|
B |
104918 |
| 96750 |
|
B |
104931 |
| 96752 |
|
B |
104933 |
| 96753 |
|
B |
104934 |
| 96754 |
|
B |
104935 |
| 96755 |
|
B |
104936 |
| 96767 |
|
B |
104948 |
| 96768 |
|
B |
104949 |
| 96769 |
|
B |
104950 |
| 96770 |
|
B |
104951 |
| 96788 |
|
B |
104969 |
| 97011 |
|
B |
105192 |
| 97012 |
|
B |
105193 |
| 97013 |
|
B |
105194 |
| 97014 |
|
B |
105195 |
| 97018 |
|
B |
105199 |
| 97019 |
|
B |
105200 |
| 97020 |
|
B |
105201 |
| 97021 |
|
B |
105202 |
| 97034 |
|
B |
105215 |
| 97035 |
|
B |
105216 |
| 97036 |
|
B |
105217 |
| 97037 |
|
B |
105218 |
| 97038 |
|
B |
105219 |