Query time 0.00123
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 (88172,88220,84778,85673,85693,85705,85717,87551,88404,88658,88700,88705,88747,87448,87460,88492,88500,89453,89466,89474,89482,91434,91442,91448,91456,84764,85659,85681,89019,89104,89112,88752,88794,88795,87504,87520,88444,88462,88478,89458,85728,85745,85755,85765,90831,88553,89976,89977)) 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 |
| 84764 |
|
D |
92802 |
| 84778 |
|
D |
92816 |
| 85659 |
|
D |
93697 |
| 85673 |
|
D |
93711 |
| 85681 |
|
D |
93719 |
| 85693 |
|
D |
93731 |
| 85705 |
|
D |
93743 |
| 85717 |
|
D |
93755 |
| 85728 |
|
D |
93766 |
| 85745 |
|
D |
93783 |
| 85755 |
|
D |
93793 |
| 85765 |
|
D |
93803 |
| 87448 |
|
D |
95486 |
| 87460 |
|
D |
95498 |
| 87504 |
|
D |
95542 |
| 87520 |
|
D |
95558 |
| 87551 |
|
D |
95589 |
| 88172 |
|
D |
96210 |
| 88220 |
|
D |
96258 |
| 88404 |
|
D |
96442 |
| 88444 |
|
D |
96482 |
| 88462 |
|
D |
96500 |
| 88478 |
|
D |
96516 |
| 88492 |
|
D |
96530 |
| 88500 |
|
D |
96538 |
| 88553 |
|
D |
96591 |
| 88658 |
|
D |
96696 |
| 88700 |
|
D |
96738 |
| 88705 |
|
D |
96743 |
| 88747 |
|
D |
96785 |
| 88752 |
|
D |
96790 |
| 88794 |
|
D |
96832 |
| 88795 |
|
D |
96833 |
| 89019 |
|
D |
97057 |
| 89104 |
|
D |
97142 |
| 89112 |
|
D |
97150 |
| 89453 |
|
D |
97491 |
| 89458 |
|
D |
97496 |
| 89466 |
|
D |
97504 |
| 89474 |
|
D |
97512 |
| 89482 |
|
D |
97520 |
| 89976 |
|
D |
98014 |
| 89977 |
|
D |
98015 |
| 90831 |
|
D |
98884 |
| 91434 |
|
D |
99507 |
| 91442 |
|
D |
99515 |
| 91448 |
|
D |
99521 |
| 91456 |
|
D |
99529 |