Query time 0.00162
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 (98024,98025,98026,98027,98028,98029,98515,98521,98522,99054,99055,99189,99190,99191,99239,99356,99357,99358,99359,99360,99361,99362,99363,99364,99365,99366,99374,99375,99376,99377,99378,99379,99380,99381,99382,99383,99384,99385,99386,99387,99388,99389,99390,99391,99392,99393,99394,99395)) 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 |
| 98024 |
|
B |
106205 |
| 98025 |
|
B |
106206 |
| 98026 |
|
B |
106207 |
| 98027 |
|
B |
106208 |
| 98028 |
|
B |
106209 |
| 98029 |
|
B |
106210 |
| 98515 |
|
B |
106696 |
| 98521 |
|
B |
106702 |
| 98522 |
|
B |
106703 |
| 99054 |
|
B |
107235 |
| 99055 |
|
B |
107236 |
| 99189 |
|
B |
107370 |
| 99190 |
|
B |
107371 |
| 99191 |
|
B |
107372 |
| 99239 |
|
B |
107420 |
| 99356 |
|
B |
107537 |
| 99357 |
|
B |
107538 |
| 99358 |
|
B |
107539 |
| 99359 |
|
B |
107540 |
| 99360 |
|
B |
107541 |
| 99361 |
|
B |
107542 |
| 99362 |
|
B |
107543 |
| 99363 |
|
B |
107544 |
| 99364 |
|
B |
107545 |
| 99365 |
|
B |
107546 |
| 99366 |
|
B |
107547 |
| 99374 |
|
B |
107555 |
| 99375 |
|
B |
107556 |
| 99376 |
|
B |
107557 |
| 99377 |
|
B |
107558 |
| 99378 |
|
B |
107559 |
| 99379 |
|
B |
107560 |
| 99380 |
|
B |
107561 |
| 99381 |
|
B |
107562 |
| 99382 |
|
B |
107563 |
| 99383 |
|
B |
107564 |
| 99384 |
|
B |
107565 |
| 99385 |
|
B |
107566 |
| 99386 |
|
B |
107567 |
| 99387 |
|
B |
107568 |
| 99388 |
|
B |
107569 |
| 99389 |
|
B |
107570 |
| 99390 |
|
B |
107571 |
| 99391 |
|
B |
107572 |
| 99392 |
|
B |
107573 |
| 99393 |
|
B |
107574 |
| 99394 |
|
B |
107575 |
| 99395 |
|
B |
107576 |