Query time 0.00112
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 (97119,97120,97121,97122,97123,97124,97125,97126,97127,97128,97129,97130,97131,97132,97133,97134,97135,97136,97137,97138,97139,97140,97141,97142,97143,97144,97145,97146,97147,97148,97149,97150,97151,97152,97153,97154,97155,97156,97157,97158,97159,97160,97161,97162,97163,97164,97165,97166)) 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 |
| 97119 |
|
B |
105300 |
| 97120 |
|
B |
105301 |
| 97121 |
|
B |
105302 |
| 97122 |
|
B |
105303 |
| 97123 |
|
B |
105304 |
| 97124 |
|
B |
105305 |
| 97125 |
|
B |
105306 |
| 97126 |
|
B |
105307 |
| 97127 |
|
B |
105308 |
| 97128 |
|
B |
105309 |
| 97129 |
|
B |
105310 |
| 97130 |
|
B |
105311 |
| 97131 |
|
B |
105312 |
| 97132 |
|
B |
105313 |
| 97133 |
|
B |
105314 |
| 97134 |
|
B |
105315 |
| 97135 |
|
B |
105316 |
| 97136 |
|
B |
105317 |
| 97137 |
|
B |
105318 |
| 97138 |
|
B |
105319 |
| 97139 |
|
B |
105320 |
| 97140 |
|
B |
105321 |
| 97141 |
|
B |
105322 |
| 97142 |
|
B |
105323 |
| 97143 |
|
B |
105324 |
| 97144 |
|
B |
105325 |
| 97145 |
|
B |
105326 |
| 97146 |
|
B |
105327 |
| 97147 |
|
B |
105328 |
| 97148 |
|
B |
105329 |
| 97149 |
|
B |
105330 |
| 97150 |
|
B |
105331 |
| 97151 |
|
B |
105332 |
| 97152 |
|
B |
105333 |
| 97153 |
|
B |
105334 |
| 97154 |
|
B |
105335 |
| 97155 |
|
B |
105336 |
| 97156 |
|
B |
105337 |
| 97157 |
|
B |
105338 |
| 97158 |
|
B |
105339 |
| 97159 |
|
B |
105340 |
| 97160 |
|
B |
105341 |
| 97161 |
|
B |
105342 |
| 97162 |
|
B |
105343 |
| 97163 |
|
B |
105344 |
| 97164 |
|
B |
105345 |
| 97165 |
|
B |
105346 |
| 97166 |
|
B |
105347 |