Query time 0.00109
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "81.91"
},
"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": 71,
"rows_produced_per_join": 71,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (92176,92177,92178,92322,92323,92324,92161,92162,92163,92164,92165,92166,84712,84711,84710,84940,84728,84729,84730,84731,84732,84733,84720,84723,84727,84734,84735,84719,84722,84724,84744,84718,84721,84937,84936,84949,84950,84690,84847,84854,84855,84689,84754,84755,84943,84944,84958,84952,84953,84746,87963,87971,84861,84862,84851,94451,94798,94799,94823,94824,95743,95744,95745,95746,95747,95748,95749,95750,95813,95814,95815)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "42.61",
"eval_cost": "7.10",
"prefix_cost": "49.71",
"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": 71,
"filtered": "100.00",
"cost_info": {
"read_cost": "17.75",
"eval_cost": "7.10",
"prefix_cost": "74.56",
"data_read_per_join": "31K"
},
"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": 71,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "7.10",
"prefix_cost": "81.91",
"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 |
| 84689 |
|
D |
92727 |
| 84690 |
|
D |
92728 |
| 84710 |
|
D |
92748 |
| 84711 |
|
D |
92749 |
| 84712 |
|
D |
92750 |
| 84718 |
|
D |
92756 |
| 84719 |
|
D |
92757 |
| 84720 |
|
D |
92758 |
| 84721 |
|
D |
92759 |
| 84722 |
|
D |
92760 |
| 84723 |
|
D |
92761 |
| 84724 |
|
D |
92762 |
| 84727 |
|
D |
92765 |
| 84728 |
|
D |
92766 |
| 84729 |
|
D |
92767 |
| 84730 |
|
D |
92768 |
| 84731 |
|
D |
92769 |
| 84732 |
|
D |
92770 |
| 84733 |
|
D |
92771 |
| 84734 |
|
D |
92772 |
| 84735 |
|
D |
92773 |
| 84744 |
|
D |
92782 |
| 84746 |
|
D |
92784 |
| 84754 |
|
D |
92792 |
| 84755 |
|
D |
92793 |
| 84847 |
|
D |
92885 |
| 84851 |
|
D |
92889 |
| 84854 |
|
D |
92892 |
| 84855 |
|
D |
92893 |
| 84861 |
|
D |
92899 |
| 84862 |
|
D |
92900 |
| 84936 |
|
D |
92974 |
| 84937 |
|
D |
92975 |
| 84940 |
|
D |
92978 |
| 84943 |
|
D |
92981 |
| 84944 |
|
D |
92982 |
| 84949 |
|
D |
92987 |
| 84950 |
|
D |
92988 |
| 84952 |
|
D |
92990 |
| 84953 |
|
D |
92991 |
| 84958 |
|
D |
92996 |
| 87963 |
|
D |
96001 |
| 87971 |
|
D |
96009 |
| 92161 |
|
D |
100239 |
| 92162 |
|
D |
100240 |
| 92163 |
|
D |
100241 |
| 92164 |
|
D |
100242 |
| 92165 |
|
D |
100243 |
| 92166 |
|
D |
100244 |
| 92176 |
|
D |
100254 |
| 92177 |
|
D |
100255 |
| 92178 |
|
D |
100256 |
| 92322 |
|
D |
100426 |
| 92323 |
|
D |
100427 |
| 92324 |
|
D |
100428 |
| 94451 |
|
B |
102623 |
| 94798 |
|
B |
102970 |
| 94799 |
|
B |
102971 |
| 94823 |
|
B |
102995 |
| 94824 |
|
B |
102996 |
| 95743 |
|
B |
103915 |
| 95744 |
|
B |
103916 |
| 95745 |
|
B |
103917 |
| 95746 |
|
B |
103918 |
| 95747 |
|
B |
103919 |
| 95748 |
|
B |
103920 |
| 95749 |
|
B |
103921 |
| 95750 |
|
B |
103922 |
| 95813 |
|
B |
103985 |
| 95814 |
|
B |
103986 |
| 95815 |
|
B |
103987 |