Query time 0.00117
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 (89059,89060,89063,89064,89058,89206,89207,89210,89211,89219,89220,89223,89224,89232,89233,89236,89237,89055,89056,89062,89054,86187,86210,86511,86787,83060,90896,90975,85069,85155,85201,85247,85109,86141,86164,86649,86718,89815,89867,89939,91505,82841,82914,82987,85303,85400,85451,85502)) 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 |
| 82841 |
|
D |
90879 |
| 82914 |
|
D |
90952 |
| 82987 |
|
D |
91025 |
| 83060 |
|
D |
91098 |
| 85069 |
|
D |
93107 |
| 85109 |
|
D |
93147 |
| 85155 |
|
D |
93193 |
| 85201 |
|
D |
93239 |
| 85247 |
|
D |
93285 |
| 85303 |
|
D |
93341 |
| 85400 |
|
D |
93438 |
| 85451 |
|
D |
93489 |
| 85502 |
|
D |
93540 |
| 86141 |
|
D |
94179 |
| 86164 |
|
D |
94202 |
| 86187 |
|
D |
94225 |
| 86210 |
|
D |
94248 |
| 86511 |
|
D |
94549 |
| 86649 |
|
D |
94687 |
| 86718 |
|
D |
94756 |
| 86787 |
|
D |
94825 |
| 89054 |
|
D |
97092 |
| 89055 |
|
D |
97093 |
| 89056 |
|
D |
97094 |
| 89058 |
|
D |
97096 |
| 89059 |
|
D |
97097 |
| 89060 |
|
D |
97098 |
| 89062 |
|
D |
97100 |
| 89063 |
|
D |
97101 |
| 89064 |
|
D |
97102 |
| 89206 |
|
D |
97244 |
| 89207 |
|
D |
97245 |
| 89210 |
|
D |
97248 |
| 89211 |
|
D |
97249 |
| 89219 |
|
D |
97257 |
| 89220 |
|
D |
97258 |
| 89223 |
|
D |
97261 |
| 89224 |
|
D |
97262 |
| 89232 |
|
D |
97270 |
| 89233 |
|
D |
97271 |
| 89236 |
|
D |
97274 |
| 89237 |
|
D |
97275 |
| 89815 |
|
D |
97853 |
| 89867 |
|
D |
97905 |
| 89939 |
|
D |
97977 |
| 90896 |
|
D |
98969 |
| 90975 |
|
D |
99048 |
| 91505 |
|
D |
99578 |