Query time 0.00080
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "34.76"
},
"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": 30,
"rows_produced_per_join": 30,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (92581,92582,92583,92584,92585,92586,92587,92588,92589,92590,92591,92592,93296,93297,93298,93299,93300,93301,93302,93303,93304,93305,93306,93307,93308,93309,93310,93311,93312,93313)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "18.01",
"eval_cost": "3.00",
"prefix_cost": "21.01",
"data_read_per_join": "720"
},
"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": 30,
"filtered": "100.00",
"cost_info": {
"read_cost": "7.50",
"eval_cost": "3.00",
"prefix_cost": "31.51",
"data_read_per_join": "13K"
},
"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": 30,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "3.00",
"prefix_cost": "34.76",
"data_read_per_join": "480"
},
"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 |
| 92581 |
|
B |
100721 |
| 92582 |
|
B |
100722 |
| 92583 |
|
B |
100723 |
| 92584 |
|
B |
100724 |
| 92585 |
|
B |
100725 |
| 92586 |
|
B |
100726 |
| 92587 |
|
B |
100727 |
| 92588 |
|
B |
100728 |
| 92589 |
|
B |
100729 |
| 92590 |
|
B |
100730 |
| 92591 |
|
B |
100731 |
| 92592 |
|
B |
100732 |
| 93296 |
|
B |
101436 |
| 93297 |
|
B |
101437 |
| 93298 |
|
B |
101438 |
| 93299 |
|
B |
101439 |
| 93300 |
|
B |
101440 |
| 93301 |
|
B |
101441 |
| 93302 |
|
B |
101442 |
| 93303 |
|
B |
101443 |
| 93304 |
|
B |
101444 |
| 93305 |
|
B |
101445 |
| 93306 |
|
B |
101446 |
| 93307 |
|
B |
101447 |
| 93308 |
|
B |
101448 |
| 93309 |
|
B |
101449 |
| 93310 |
|
B |
101450 |
| 93311 |
|
B |
101451 |
| 93312 |
|
B |
101452 |
| 93313 |
|
B |
101453 |