Query time 0.00093
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 (98079,98080,98081,98082,98083,98149,98150,98153,98156,98176,98177,98178,98179,98180,98181,98182,98183,98184,98185,98186,98187,98188,98189,98190,98191,98192,98193,98194,98195,98196,98197,98198,98199,98200,98201,98202,98203,98204,98205,98206,98207,98208,98209,98210,98211,98212,98213,98214)) 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_2",
"used_key_parts": [
"thread_id",
"status"
],
"key_length": "6",
"ref": [
"nuie_scalesta_net.cscart_discussion.thread_id",
"const"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 48,
"filtered": "100.00",
"using_index": true,
"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"
]
}
},
{
"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 |
| 98079 |
|
B |
106260 |
| 98080 |
|
B |
106261 |
| 98081 |
|
B |
106262 |
| 98082 |
|
B |
106263 |
| 98083 |
|
B |
106264 |
| 98149 |
|
B |
106330 |
| 98150 |
|
B |
106331 |
| 98153 |
|
B |
106334 |
| 98156 |
|
B |
106337 |
| 98176 |
|
B |
106357 |
| 98177 |
|
B |
106358 |
| 98178 |
|
B |
106359 |
| 98179 |
|
B |
106360 |
| 98180 |
|
B |
106361 |
| 98181 |
|
B |
106362 |
| 98182 |
|
B |
106363 |
| 98183 |
|
B |
106364 |
| 98184 |
|
B |
106365 |
| 98185 |
|
B |
106366 |
| 98186 |
|
B |
106367 |
| 98187 |
|
B |
106368 |
| 98188 |
|
B |
106369 |
| 98189 |
|
B |
106370 |
| 98190 |
|
B |
106371 |
| 98191 |
|
B |
106372 |
| 98192 |
|
B |
106373 |
| 98193 |
|
B |
106374 |
| 98194 |
|
B |
106375 |
| 98195 |
|
B |
106376 |
| 98196 |
|
B |
106377 |
| 98197 |
|
B |
106378 |
| 98198 |
|
B |
106379 |
| 98199 |
|
B |
106380 |
| 98200 |
|
B |
106381 |
| 98201 |
|
B |
106382 |
| 98202 |
|
B |
106383 |
| 98203 |
|
B |
106384 |
| 98204 |
|
B |
106385 |
| 98205 |
|
B |
106386 |
| 98206 |
|
B |
106387 |
| 98207 |
|
B |
106388 |
| 98208 |
|
B |
106389 |
| 98209 |
|
B |
106390 |
| 98210 |
|
B |
106391 |
| 98211 |
|
B |
106392 |
| 98212 |
|
B |
106393 |
| 98213 |
|
B |
106394 |
| 98214 |
|
B |
106395 |