Query time 0.00099
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 (82617,82625,82626,83418,83420,83490,83491,86651,86720,87300,87301,89814,89866,89938,91504,82840,82913,82986,83400,83410,86604,86673,82612,83411,88249,85302,85399,85450,85501,83014,83015,83546,83547,90847,90848,90926,90927,90743,90744,90746,90747,90749,90750,90752,90753,84319,84320,85275)) 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 |
| 82612 |
|
D |
90650 |
| 82617 |
|
D |
90655 |
| 82625 |
|
D |
90663 |
| 82626 |
|
D |
90664 |
| 82840 |
|
D |
90878 |
| 82913 |
|
D |
90951 |
| 82986 |
|
D |
91024 |
| 83014 |
|
D |
91052 |
| 83015 |
|
D |
91053 |
| 83400 |
|
D |
91438 |
| 83410 |
|
D |
91448 |
| 83411 |
|
D |
91449 |
| 83418 |
|
D |
91456 |
| 83420 |
|
D |
91458 |
| 83490 |
|
D |
91528 |
| 83491 |
|
D |
91529 |
| 83546 |
|
D |
91584 |
| 83547 |
|
D |
91585 |
| 84319 |
|
D |
92357 |
| 84320 |
|
D |
92358 |
| 85275 |
|
D |
93313 |
| 85302 |
|
D |
93340 |
| 85399 |
|
D |
93437 |
| 85450 |
|
D |
93488 |
| 85501 |
|
D |
93539 |
| 86604 |
|
D |
94642 |
| 86651 |
|
D |
94689 |
| 86673 |
|
D |
94711 |
| 86720 |
|
D |
94758 |
| 87300 |
|
D |
95338 |
| 87301 |
|
D |
95339 |
| 88249 |
|
D |
96287 |
| 89814 |
|
D |
97852 |
| 89866 |
|
D |
97904 |
| 89938 |
|
D |
97976 |
| 90743 |
|
D |
98796 |
| 90744 |
|
D |
98797 |
| 90746 |
|
D |
98799 |
| 90747 |
|
D |
98800 |
| 90749 |
|
D |
98802 |
| 90750 |
|
D |
98803 |
| 90752 |
|
D |
98805 |
| 90753 |
|
D |
98806 |
| 90847 |
|
D |
98920 |
| 90848 |
|
D |
98921 |
| 90926 |
|
D |
98999 |
| 90927 |
|
D |
99000 |
| 91504 |
|
D |
99577 |