Query time 0.00182
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "78.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": 68,
"rows_produced_per_join": 68,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (88078,89985,89986,88041,88055,88085,88071,88076,88072,87960,88030,88019,87992,88001,88005,87939,87989,87943,87973,87999,90808,87965,88014,88020,94485,94492,94510,94574,94579,95757,95759,95773,95777,95827,95828,97609,97616,97634,97698,97703,99113,99117,99131,99135,99144,99165,99168,99174,99176,99179,99193,99198,99199,99208,99219,99233,99249,99250,99254,99256,99263,99275,99279,99345,100674,100675,101682,101683)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "40.81",
"eval_cost": "6.80",
"prefix_cost": "47.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": 68,
"filtered": "100.00",
"cost_info": {
"read_cost": "17.00",
"eval_cost": "6.80",
"prefix_cost": "71.41",
"data_read_per_join": "29K"
},
"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": 68,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "6.80",
"prefix_cost": "78.46",
"data_read_per_join": "1K"
},
"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 |
| 87939 |
|
D |
95977 |
| 87943 |
|
D |
95981 |
| 87960 |
|
D |
95998 |
| 87965 |
|
D |
96003 |
| 87973 |
|
D |
96011 |
| 87989 |
|
D |
96027 |
| 87992 |
|
D |
96030 |
| 87999 |
|
D |
96037 |
| 88001 |
|
D |
96039 |
| 88005 |
|
D |
96043 |
| 88014 |
|
D |
96052 |
| 88019 |
|
D |
96057 |
| 88020 |
|
D |
96058 |
| 88030 |
|
D |
96068 |
| 88041 |
|
D |
96079 |
| 88055 |
|
D |
96093 |
| 88071 |
|
D |
96109 |
| 88072 |
|
D |
96110 |
| 88076 |
|
D |
96114 |
| 88078 |
|
D |
96116 |
| 88085 |
|
D |
96123 |
| 89985 |
|
D |
98023 |
| 89986 |
|
D |
98024 |
| 90808 |
|
D |
98861 |
| 94485 |
|
B |
102657 |
| 94492 |
|
B |
102664 |
| 94510 |
|
B |
102682 |
| 94574 |
|
B |
102746 |
| 94579 |
|
B |
102751 |
| 95757 |
|
B |
103929 |
| 95759 |
|
B |
103931 |
| 95773 |
|
B |
103945 |
| 95777 |
|
B |
103949 |
| 95827 |
|
B |
103999 |
| 95828 |
|
B |
104000 |
| 97609 |
|
B |
105790 |
| 97616 |
|
B |
105797 |
| 97634 |
|
B |
105815 |
| 97698 |
|
B |
105879 |
| 97703 |
|
B |
105884 |
| 99113 |
|
B |
107294 |
| 99117 |
|
B |
107298 |
| 99131 |
|
B |
107312 |
| 99135 |
|
B |
107316 |
| 99144 |
|
B |
107325 |
| 99165 |
|
B |
107346 |
| 99168 |
|
B |
107349 |
| 99174 |
|
B |
107355 |
| 99176 |
|
B |
107357 |
| 99179 |
|
B |
107360 |
| 99193 |
|
B |
107374 |
| 99198 |
|
B |
107379 |
| 99199 |
|
B |
107380 |
| 99208 |
|
B |
107389 |
| 99219 |
|
B |
107400 |
| 99233 |
|
B |
107414 |
| 99249 |
|
B |
107430 |
| 99250 |
|
B |
107431 |
| 99254 |
|
B |
107435 |
| 99256 |
|
B |
107437 |
| 99263 |
|
B |
107444 |
| 99275 |
|
B |
107456 |
| 99279 |
|
B |
107460 |
| 99345 |
|
B |
107526 |
| 100674 |
|
B |
108854 |
| 100675 |
|
B |
108855 |
| 101682 |
|
B |
109865 |
| 101683 |
|
B |
109866 |