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 (89686,88383,88384,89683,89684,88363,88109,88121,88133,88280,88281,88282,88357,89680,89681,89682,88362,88108,88120,88132,88276,88277,88278,88279,89676,89677,89678,89679,88355,88356,88358,88359,88360,88361,89696,89675,88107,88119,88131,88275,88304,88305,88353,88354,88271,89674,88351,88352)) 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 |
| 88107 |
|
D |
96145 |
| 88108 |
|
D |
96146 |
| 88109 |
|
D |
96147 |
| 88119 |
|
D |
96157 |
| 88120 |
|
D |
96158 |
| 88121 |
|
D |
96159 |
| 88131 |
|
D |
96169 |
| 88132 |
|
D |
96170 |
| 88133 |
|
D |
96171 |
| 88271 |
|
D |
96309 |
| 88275 |
|
D |
96313 |
| 88276 |
|
D |
96314 |
| 88277 |
|
D |
96315 |
| 88278 |
|
D |
96316 |
| 88279 |
|
D |
96317 |
| 88280 |
|
D |
96318 |
| 88281 |
|
D |
96319 |
| 88282 |
|
D |
96320 |
| 88304 |
|
D |
96342 |
| 88305 |
|
D |
96343 |
| 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 |
| 88383 |
|
D |
96421 |
| 88384 |
|
D |
96422 |
| 89674 |
|
D |
97712 |
| 89675 |
|
D |
97713 |
| 89676 |
|
D |
97714 |
| 89677 |
|
D |
97715 |
| 89678 |
|
D |
97716 |
| 89679 |
|
D |
97717 |
| 89680 |
|
D |
97718 |
| 89681 |
|
D |
97719 |
| 89682 |
|
D |
97720 |
| 89683 |
|
D |
97721 |
| 89684 |
|
D |
97722 |
| 89686 |
|
D |
97724 |
| 89696 |
|
D |
97734 |