Query time 0.00129
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "50.86"
},
"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": 44,
"rows_produced_per_join": 44,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (88113,88111,88112,88110,88363,88109,88357,88362,88108,88355,88356,88358,88359,88360,88361,88107,88353,88354,88351,88352,88106,88348,88349,88350,88344,88345,88346,88347,88343,88342,88338,88337,88330,88340,88341,88335,88336,88333,88331,88332,88339,88328,88327,88326)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "26.41",
"eval_cost": "4.40",
"prefix_cost": "30.81",
"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": 44,
"filtered": "100.00",
"cost_info": {
"read_cost": "11.00",
"eval_cost": "4.40",
"prefix_cost": "46.21",
"data_read_per_join": "19K"
},
"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": 44,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "4.40",
"prefix_cost": "50.86",
"data_read_per_join": "704"
},
"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 |
| 88106 |
|
D |
96144 |
| 88107 |
|
D |
96145 |
| 88108 |
|
D |
96146 |
| 88109 |
|
D |
96147 |
| 88110 |
|
D |
96148 |
| 88111 |
|
D |
96149 |
| 88112 |
|
D |
96150 |
| 88113 |
|
D |
96151 |
| 88326 |
|
D |
96364 |
| 88327 |
|
D |
96365 |
| 88328 |
|
D |
96366 |
| 88330 |
|
D |
96368 |
| 88331 |
|
D |
96369 |
| 88332 |
|
D |
96370 |
| 88333 |
|
D |
96371 |
| 88335 |
|
D |
96373 |
| 88336 |
|
D |
96374 |
| 88337 |
|
D |
96375 |
| 88338 |
|
D |
96376 |
| 88339 |
|
D |
96377 |
| 88340 |
|
D |
96378 |
| 88341 |
|
D |
96379 |
| 88342 |
|
D |
96380 |
| 88343 |
|
D |
96381 |
| 88344 |
|
D |
96382 |
| 88345 |
|
D |
96383 |
| 88346 |
|
D |
96384 |
| 88347 |
|
D |
96385 |
| 88348 |
|
D |
96386 |
| 88349 |
|
D |
96387 |
| 88350 |
|
D |
96388 |
| 88351 |
|
D |
96389 |
| 88352 |
|
D |
96390 |
| 88353 |
|
D |
96391 |
| 88354 |
|
D |
96392 |
| 88355 |
|
D |
96393 |
| 88356 |
|
D |
96394 |
| 88357 |
|
D |
96395 |
| 88358 |
|
D |
96396 |
| 88359 |
|
D |
96397 |
| 88360 |
|
D |
96398 |
| 88361 |
|
D |
96399 |
| 88362 |
|
D |
96400 |
| 88363 |
|
D |
96401 |