Query time 0.00107
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 (86866,86300,86326,86270,86291,86299,86325,86244,86269,86290,86292,86318,87736,86346,86350,86256,86309,86369,86374,86298,86324,86311,86327,86260,86308,86243,86378,86246,86268,86289,86304,86317,86373,86347,86351,86344,86348,86376,86303,86316,86254,86306,86371,86313,86329,86312,86328,86245)) 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 |
| 86243 |
|
D |
94281 |
| 86244 |
|
D |
94282 |
| 86245 |
|
D |
94283 |
| 86246 |
|
D |
94284 |
| 86254 |
|
D |
94292 |
| 86256 |
|
D |
94294 |
| 86260 |
|
D |
94298 |
| 86268 |
|
D |
94306 |
| 86269 |
|
D |
94307 |
| 86270 |
|
D |
94308 |
| 86289 |
|
D |
94327 |
| 86290 |
|
D |
94328 |
| 86291 |
|
D |
94329 |
| 86292 |
|
D |
94330 |
| 86298 |
|
D |
94336 |
| 86299 |
|
D |
94337 |
| 86300 |
|
D |
94338 |
| 86303 |
|
D |
94341 |
| 86304 |
|
D |
94342 |
| 86306 |
|
D |
94344 |
| 86308 |
|
D |
94346 |
| 86309 |
|
D |
94347 |
| 86311 |
|
D |
94349 |
| 86312 |
|
D |
94350 |
| 86313 |
|
D |
94351 |
| 86316 |
|
D |
94354 |
| 86317 |
|
D |
94355 |
| 86318 |
|
D |
94356 |
| 86324 |
|
D |
94362 |
| 86325 |
|
D |
94363 |
| 86326 |
|
D |
94364 |
| 86327 |
|
D |
94365 |
| 86328 |
|
D |
94366 |
| 86329 |
|
D |
94367 |
| 86344 |
|
D |
94382 |
| 86346 |
|
D |
94384 |
| 86347 |
|
D |
94385 |
| 86348 |
|
D |
94386 |
| 86350 |
|
D |
94388 |
| 86351 |
|
D |
94389 |
| 86369 |
|
D |
94407 |
| 86371 |
|
D |
94409 |
| 86373 |
|
D |
94411 |
| 86374 |
|
D |
94412 |
| 86376 |
|
D |
94414 |
| 86378 |
|
D |
94416 |
| 86866 |
|
D |
94904 |
| 87736 |
|
D |
95774 |