Query time 0.00121
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "66.96"
},
"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": 58,
"rows_produced_per_join": 58,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (99136,99137,99138,99139,99140,99145,99146,99147,99148,99149,99150,99153,99154,99155,99156,99157,99158,99159,99160,99161,99167,99181,99185,99186,99187,99188,99195,99196,99201,99202,99205,99210,99211,99212,99213,99214,99215,99216,99217,99220,99234,99235,99236,99237,99238,99240,99241,99264,99265,99266,99267,99268,99269,100386,100387,100393,100394,100434)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "34.81",
"eval_cost": "5.80",
"prefix_cost": "40.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": 58,
"filtered": "100.00",
"cost_info": {
"read_cost": "14.50",
"eval_cost": "5.80",
"prefix_cost": "60.91",
"data_read_per_join": "25K"
},
"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": 58,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "5.80",
"prefix_cost": "66.96",
"data_read_per_join": "928"
},
"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 |
| 99136 |
|
B |
107317 |
| 99137 |
|
B |
107318 |
| 99138 |
|
B |
107319 |
| 99139 |
|
B |
107320 |
| 99140 |
|
B |
107321 |
| 99145 |
|
B |
107326 |
| 99146 |
|
B |
107327 |
| 99147 |
|
B |
107328 |
| 99148 |
|
B |
107329 |
| 99149 |
|
B |
107330 |
| 99150 |
|
B |
107331 |
| 99153 |
|
B |
107334 |
| 99154 |
|
B |
107335 |
| 99155 |
|
B |
107336 |
| 99156 |
|
B |
107337 |
| 99157 |
|
B |
107338 |
| 99158 |
|
B |
107339 |
| 99159 |
|
B |
107340 |
| 99160 |
|
B |
107341 |
| 99161 |
|
B |
107342 |
| 99167 |
|
B |
107348 |
| 99181 |
|
B |
107362 |
| 99185 |
|
B |
107366 |
| 99186 |
|
B |
107367 |
| 99187 |
|
B |
107368 |
| 99188 |
|
B |
107369 |
| 99195 |
|
B |
107376 |
| 99196 |
|
B |
107377 |
| 99201 |
|
B |
107382 |
| 99202 |
|
B |
107383 |
| 99205 |
|
B |
107386 |
| 99210 |
|
B |
107391 |
| 99211 |
|
B |
107392 |
| 99212 |
|
B |
107393 |
| 99213 |
|
B |
107394 |
| 99214 |
|
B |
107395 |
| 99215 |
|
B |
107396 |
| 99216 |
|
B |
107397 |
| 99217 |
|
B |
107398 |
| 99220 |
|
B |
107401 |
| 99234 |
|
B |
107415 |
| 99235 |
|
B |
107416 |
| 99236 |
|
B |
107417 |
| 99237 |
|
B |
107418 |
| 99238 |
|
B |
107419 |
| 99240 |
|
B |
107421 |
| 99241 |
|
B |
107422 |
| 99264 |
|
B |
107445 |
| 99265 |
|
B |
107446 |
| 99266 |
|
B |
107447 |
| 99267 |
|
B |
107448 |
| 99268 |
|
B |
107449 |
| 99269 |
|
B |
107450 |
| 100386 |
|
B |
108566 |
| 100387 |
|
B |
108567 |
| 100393 |
|
B |
108573 |
| 100394 |
|
B |
108574 |
| 100434 |
|
B |
108614 |