Query time 0.00096
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 (92176,92177,92178,91061,84716,85272,85273,88063,84738,92171,84726,84742,91063,91062,91057,92322,92323,92324,83897,83898,83900,83901,83902,83903,83904,83905,83906,84935,88062,91060,91055,91058,84858,91735,91736,91737,91738,91739,91740,91741,91742,91743,91744,91745,91746,91747,91748,91749)) 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 |
| 83897 |
|
D |
91935 |
| 83898 |
|
D |
91936 |
| 83900 |
|
D |
91938 |
| 83901 |
|
D |
91939 |
| 83902 |
|
D |
91940 |
| 83903 |
|
D |
91941 |
| 83904 |
|
D |
91942 |
| 83905 |
|
D |
91943 |
| 83906 |
|
D |
91944 |
| 84716 |
|
D |
92754 |
| 84726 |
|
D |
92764 |
| 84738 |
|
D |
92776 |
| 84742 |
|
D |
92780 |
| 84858 |
|
D |
92896 |
| 84935 |
|
D |
92973 |
| 85272 |
|
D |
93310 |
| 85273 |
|
D |
93311 |
| 88062 |
|
D |
96100 |
| 88063 |
|
D |
96101 |
| 91055 |
|
D |
99128 |
| 91057 |
|
D |
99130 |
| 91058 |
|
D |
99131 |
| 91060 |
|
D |
99133 |
| 91061 |
|
D |
99134 |
| 91062 |
|
D |
99135 |
| 91063 |
|
D |
99136 |
| 91735 |
|
D |
99808 |
| 91736 |
|
D |
99809 |
| 91737 |
|
D |
99810 |
| 91738 |
|
D |
99811 |
| 91739 |
|
D |
99812 |
| 91740 |
|
D |
99813 |
| 91741 |
|
D |
99814 |
| 91742 |
|
D |
99815 |
| 91743 |
|
D |
99816 |
| 91744 |
|
D |
99817 |
| 91745 |
|
D |
99818 |
| 91746 |
|
D |
99819 |
| 91747 |
|
D |
99820 |
| 91748 |
|
D |
99821 |
| 91749 |
|
D |
99822 |
| 92171 |
|
D |
100249 |
| 92176 |
|
D |
100254 |
| 92177 |
|
D |
100255 |
| 92178 |
|
D |
100256 |
| 92322 |
|
D |
100426 |
| 92323 |
|
D |
100427 |
| 92324 |
|
D |
100428 |