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 (90108,89006,89013,84007,84009,84011,84013,89010,91307,83963,83965,83967,83969,91303,83130,84006,84008,84010,84012,84035,90089,90099,92027,92028,92029,92030,92031,92032,92033,92035,92036,92037,92038,92039,92040,92041,92115,92116,92117,92118,92119,92120,92121,92123,92124,92125,92126,92127)) 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 |
| 83130 |
|
D |
91168 |
| 83963 |
|
D |
92001 |
| 83965 |
|
D |
92003 |
| 83967 |
|
D |
92005 |
| 83969 |
|
D |
92007 |
| 84006 |
|
D |
92044 |
| 84007 |
|
D |
92045 |
| 84008 |
|
D |
92046 |
| 84009 |
|
D |
92047 |
| 84010 |
|
D |
92048 |
| 84011 |
|
D |
92049 |
| 84012 |
|
D |
92050 |
| 84013 |
|
D |
92051 |
| 84035 |
|
D |
92073 |
| 89006 |
|
D |
97044 |
| 89010 |
|
D |
97048 |
| 89013 |
|
D |
97051 |
| 90089 |
|
D |
98127 |
| 90099 |
|
D |
98137 |
| 90108 |
|
D |
98146 |
| 91303 |
|
D |
99376 |
| 91307 |
|
D |
99380 |
| 92027 |
|
D |
100105 |
| 92028 |
|
D |
100106 |
| 92029 |
|
D |
100107 |
| 92030 |
|
D |
100108 |
| 92031 |
|
D |
100109 |
| 92032 |
|
D |
100110 |
| 92033 |
|
D |
100111 |
| 92035 |
|
D |
100113 |
| 92036 |
|
D |
100114 |
| 92037 |
|
D |
100115 |
| 92038 |
|
D |
100116 |
| 92039 |
|
D |
100117 |
| 92040 |
|
D |
100118 |
| 92041 |
|
D |
100119 |
| 92115 |
|
D |
100193 |
| 92116 |
|
D |
100194 |
| 92117 |
|
D |
100195 |
| 92118 |
|
D |
100196 |
| 92119 |
|
D |
100197 |
| 92120 |
|
D |
100198 |
| 92121 |
|
D |
100199 |
| 92123 |
|
D |
100201 |
| 92124 |
|
D |
100202 |
| 92125 |
|
D |
100203 |
| 92126 |
|
D |
100204 |
| 92127 |
|
D |
100205 |