Query time 0.00095
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 (83193,83194,84870,84871,84872,90736,90737,84883,84898,86611,86612,86680,86681,82821,82894,82967,82807,82808,82880,82881,82953,82954,83196,83197,84874,82805,82806,82878,82879,82951,82952,83190,83195,84881,84896,82604,82606,82601,82602,82588,82589,84869,90005,82586,82587,86528,86529,84865)) 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 |
| 82586 |
|
D |
90624 |
| 82587 |
|
D |
90625 |
| 82588 |
|
D |
90626 |
| 82589 |
|
D |
90627 |
| 82601 |
|
D |
90639 |
| 82602 |
|
D |
90640 |
| 82604 |
|
D |
90642 |
| 82606 |
|
D |
90644 |
| 82805 |
|
D |
90843 |
| 82806 |
|
D |
90844 |
| 82807 |
|
D |
90845 |
| 82808 |
|
D |
90846 |
| 82821 |
|
D |
90859 |
| 82878 |
|
D |
90916 |
| 82879 |
|
D |
90917 |
| 82880 |
|
D |
90918 |
| 82881 |
|
D |
90919 |
| 82894 |
|
D |
90932 |
| 82951 |
|
D |
90989 |
| 82952 |
|
D |
90990 |
| 82953 |
|
D |
90991 |
| 82954 |
|
D |
90992 |
| 82967 |
|
D |
91005 |
| 83190 |
|
D |
91228 |
| 83193 |
|
D |
91231 |
| 83194 |
|
D |
91232 |
| 83195 |
|
D |
91233 |
| 83196 |
|
D |
91234 |
| 83197 |
|
D |
91235 |
| 84865 |
|
D |
92903 |
| 84869 |
|
D |
92907 |
| 84870 |
|
D |
92908 |
| 84871 |
|
D |
92909 |
| 84872 |
|
D |
92910 |
| 84874 |
|
D |
92912 |
| 84881 |
|
D |
92919 |
| 84883 |
|
D |
92921 |
| 84896 |
|
D |
92934 |
| 84898 |
|
D |
92936 |
| 86528 |
|
D |
94566 |
| 86529 |
|
D |
94567 |
| 86611 |
|
D |
94649 |
| 86612 |
|
D |
94650 |
| 86680 |
|
D |
94718 |
| 86681 |
|
D |
94719 |
| 90005 |
|
D |
98043 |
| 90736 |
|
D |
98789 |
| 90737 |
|
D |
98790 |