Query time 0.00117
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 (94891,94892,94894,94895,94898,94903,94904,94905,94908,94909,94910,94911,94912,94913,94914,94915,94918,94921,94922,94923,94924,94925,94926,94927,94928,94929,94930,94931,94932,94933,94934,94935,94936,94937,94938,94941,94943,94944,94947,96247,96248,96249,96252,96253,96254,96255,96256,96257)) 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 |
| 94891 |
|
B |
103063 |
| 94892 |
|
B |
103064 |
| 94894 |
|
B |
103066 |
| 94895 |
|
B |
103067 |
| 94898 |
|
B |
103070 |
| 94903 |
|
B |
103075 |
| 94904 |
|
B |
103076 |
| 94905 |
|
B |
103077 |
| 94908 |
|
B |
103080 |
| 94909 |
|
B |
103081 |
| 94910 |
|
B |
103082 |
| 94911 |
|
B |
103083 |
| 94912 |
|
B |
103084 |
| 94913 |
|
B |
103085 |
| 94914 |
|
B |
103086 |
| 94915 |
|
B |
103087 |
| 94918 |
|
B |
103090 |
| 94921 |
|
B |
103093 |
| 94922 |
|
B |
103094 |
| 94923 |
|
B |
103095 |
| 94924 |
|
B |
103096 |
| 94925 |
|
B |
103097 |
| 94926 |
|
B |
103098 |
| 94927 |
|
B |
103099 |
| 94928 |
|
B |
103100 |
| 94929 |
|
B |
103101 |
| 94930 |
|
B |
103102 |
| 94931 |
|
B |
103103 |
| 94932 |
|
B |
103104 |
| 94933 |
|
B |
103105 |
| 94934 |
|
B |
103106 |
| 94935 |
|
B |
103107 |
| 94936 |
|
B |
103108 |
| 94937 |
|
B |
103109 |
| 94938 |
|
B |
103110 |
| 94941 |
|
B |
103113 |
| 94943 |
|
B |
103115 |
| 94944 |
|
B |
103116 |
| 94947 |
|
B |
103119 |
| 96247 |
|
B |
104419 |
| 96248 |
|
B |
104420 |
| 96249 |
|
B |
104421 |
| 96252 |
|
B |
104424 |
| 96253 |
|
B |
104425 |
| 96254 |
|
B |
104426 |
| 96255 |
|
B |
104427 |
| 96256 |
|
B |
104428 |
| 96257 |
|
B |
104429 |