Query time 0.00064
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 (94732,94736,94740,94744,94748,96305,96306,96307,96309,96312,96315,96317,96320,96322,96324,96326,96328,96330,96332,96335,96339,97016,97022,97023,97026,97030,97032,97039,97045,97833,97843,97847,97852,97856,97860,97864,97868,97872,97890,97891,97892,97893,97894,97895,97896,97897,97898,97899)) 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 |
| 94732 |
|
B |
102904 |
| 94736 |
|
B |
102908 |
| 94740 |
|
B |
102912 |
| 94744 |
|
B |
102916 |
| 94748 |
|
B |
102920 |
| 96305 |
|
B |
104477 |
| 96306 |
|
B |
104478 |
| 96307 |
|
B |
104479 |
| 96309 |
|
B |
104481 |
| 96312 |
|
B |
104484 |
| 96315 |
|
B |
104487 |
| 96317 |
|
B |
104489 |
| 96320 |
|
B |
104492 |
| 96322 |
|
B |
104494 |
| 96324 |
|
B |
104496 |
| 96326 |
|
B |
104498 |
| 96328 |
|
B |
104500 |
| 96330 |
|
B |
104502 |
| 96332 |
|
B |
104504 |
| 96335 |
|
B |
104507 |
| 96339 |
|
B |
104511 |
| 97016 |
|
B |
105197 |
| 97022 |
|
B |
105203 |
| 97023 |
|
B |
105204 |
| 97026 |
|
B |
105207 |
| 97030 |
|
B |
105211 |
| 97032 |
|
B |
105213 |
| 97039 |
|
B |
105220 |
| 97045 |
|
B |
105226 |
| 97833 |
|
B |
106014 |
| 97843 |
|
B |
106024 |
| 97847 |
|
B |
106028 |
| 97852 |
|
B |
106033 |
| 97856 |
|
B |
106037 |
| 97860 |
|
B |
106041 |
| 97864 |
|
B |
106045 |
| 97868 |
|
B |
106049 |
| 97872 |
|
B |
106053 |
| 97890 |
|
B |
106071 |
| 97891 |
|
B |
106072 |
| 97892 |
|
B |
106073 |
| 97893 |
|
B |
106074 |
| 97894 |
|
B |
106075 |
| 97895 |
|
B |
106076 |
| 97896 |
|
B |
106077 |
| 97897 |
|
B |
106078 |
| 97898 |
|
B |
106079 |
| 97899 |
|
B |
106080 |