Query time 0.00116
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 (94225,94226,94227,94228,94229,94230,94231,94232,94233,94234,94235,94236,94237,94238,94239,94240,94241,94242,94243,94244,94245,94246,94247,94248,94249,94250,94251,94252,94253,94254,94255,94256,94257,94258,94259,94260,94261,94262,94263,94264,94265,94266,94267,94268,94269,94270,94271,94272)) 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 |
| 94225 |
|
B |
102367 |
| 94226 |
|
B |
102368 |
| 94227 |
|
B |
102369 |
| 94228 |
|
B |
102370 |
| 94229 |
|
B |
102371 |
| 94230 |
|
B |
102372 |
| 94231 |
|
B |
102373 |
| 94232 |
|
B |
102374 |
| 94233 |
|
B |
102375 |
| 94234 |
|
B |
102376 |
| 94235 |
|
B |
102377 |
| 94236 |
|
B |
102378 |
| 94237 |
|
B |
102379 |
| 94238 |
|
B |
102380 |
| 94239 |
|
B |
102381 |
| 94240 |
|
B |
102382 |
| 94241 |
|
B |
102383 |
| 94242 |
|
B |
102384 |
| 94243 |
|
B |
102385 |
| 94244 |
|
B |
102386 |
| 94245 |
|
B |
102387 |
| 94246 |
|
B |
102388 |
| 94247 |
|
B |
102389 |
| 94248 |
|
B |
102390 |
| 94249 |
|
B |
102391 |
| 94250 |
|
B |
102392 |
| 94251 |
|
B |
102393 |
| 94252 |
|
B |
102394 |
| 94253 |
|
B |
102395 |
| 94254 |
|
B |
102396 |
| 94255 |
|
B |
102397 |
| 94256 |
|
B |
102398 |
| 94257 |
|
B |
102399 |
| 94258 |
|
B |
102400 |
| 94259 |
|
B |
102401 |
| 94260 |
|
B |
102402 |
| 94261 |
|
B |
102403 |
| 94262 |
|
B |
102404 |
| 94263 |
|
B |
102405 |
| 94264 |
|
B |
102406 |
| 94265 |
|
B |
102407 |
| 94266 |
|
B |
102408 |
| 94267 |
|
B |
102409 |
| 94268 |
|
B |
102410 |
| 94269 |
|
B |
102411 |
| 94270 |
|
B |
102412 |
| 94271 |
|
B |
102413 |
| 94272 |
|
B |
102414 |