Query time 0.00114
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 (90227,84051,84059,90281,90289,85963,90177,90178,90247,90255,83939,84083,90207,90218,90179,90133,90229,90244,90280,90288,90194,90254,90262,85962,90228,90243,83938,84082,90169,90174,90175,90206,90217,90193,84050,84058,90226,90237,90242,90253,90261,90186,85961,90252,90260,90251,90259,90279)) 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 |
| 83938 |
|
D |
91976 |
| 83939 |
|
D |
91977 |
| 84050 |
|
D |
92088 |
| 84051 |
|
D |
92089 |
| 84058 |
|
D |
92096 |
| 84059 |
|
D |
92097 |
| 84082 |
|
D |
92120 |
| 84083 |
|
D |
92121 |
| 85961 |
|
D |
93999 |
| 85962 |
|
D |
94000 |
| 85963 |
|
D |
94001 |
| 90133 |
|
D |
98171 |
| 90169 |
|
D |
98207 |
| 90174 |
|
D |
98212 |
| 90175 |
|
D |
98213 |
| 90177 |
|
D |
98215 |
| 90178 |
|
D |
98216 |
| 90179 |
|
D |
98217 |
| 90186 |
|
D |
98224 |
| 90193 |
|
D |
98231 |
| 90194 |
|
D |
98232 |
| 90206 |
|
D |
98244 |
| 90207 |
|
D |
98245 |
| 90217 |
|
D |
98255 |
| 90218 |
|
D |
98256 |
| 90226 |
|
D |
98264 |
| 90227 |
|
D |
98265 |
| 90228 |
|
D |
98266 |
| 90229 |
|
D |
98267 |
| 90237 |
|
D |
98275 |
| 90242 |
|
D |
98280 |
| 90243 |
|
D |
98281 |
| 90244 |
|
D |
98282 |
| 90247 |
|
D |
98285 |
| 90251 |
|
D |
98289 |
| 90252 |
|
D |
98290 |
| 90253 |
|
D |
98291 |
| 90254 |
|
D |
98292 |
| 90255 |
|
D |
98293 |
| 90259 |
|
D |
98297 |
| 90260 |
|
D |
98298 |
| 90261 |
|
D |
98299 |
| 90262 |
|
D |
98300 |
| 90279 |
|
D |
98317 |
| 90280 |
|
D |
98318 |
| 90281 |
|
D |
98319 |
| 90288 |
|
D |
98326 |
| 90289 |
|
D |
98327 |