Query time 0.00103
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 (84036,88933,89011,89523,90109,91308,91893,91894,91895,92050,92138,92337,92338,92339,92340,83954,83956,83958,83960,90061,85531,89623,89636,83978,83979,83980,83981,90106,88936,89648,89649,83970,83971,83972,83973,89620,89633,91304,83982,83983,83984,83985,91300,89650,89187,90067,90081,91839)) 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 |
| 83954 |
|
D |
91992 |
| 83956 |
|
D |
91994 |
| 83958 |
|
D |
91996 |
| 83960 |
|
D |
91998 |
| 83970 |
|
D |
92008 |
| 83971 |
|
D |
92009 |
| 83972 |
|
D |
92010 |
| 83973 |
|
D |
92011 |
| 83978 |
|
D |
92016 |
| 83979 |
|
D |
92017 |
| 83980 |
|
D |
92018 |
| 83981 |
|
D |
92019 |
| 83982 |
|
D |
92020 |
| 83983 |
|
D |
92021 |
| 83984 |
|
D |
92022 |
| 83985 |
|
D |
92023 |
| 84036 |
|
D |
92074 |
| 85531 |
|
D |
93569 |
| 88933 |
|
D |
96971 |
| 88936 |
|
D |
96974 |
| 89011 |
|
D |
97049 |
| 89187 |
|
D |
97225 |
| 89523 |
|
D |
97561 |
| 89620 |
|
D |
97658 |
| 89623 |
|
D |
97661 |
| 89633 |
|
D |
97671 |
| 89636 |
|
D |
97674 |
| 89648 |
|
D |
97686 |
| 89649 |
|
D |
97687 |
| 89650 |
|
D |
97688 |
| 90061 |
|
D |
98099 |
| 90067 |
|
D |
98105 |
| 90081 |
|
D |
98119 |
| 90106 |
|
D |
98144 |
| 90109 |
|
D |
98147 |
| 91300 |
|
D |
99373 |
| 91304 |
|
D |
99377 |
| 91308 |
|
D |
99381 |
| 91839 |
|
D |
99917 |
| 91893 |
|
D |
99971 |
| 91894 |
|
D |
99972 |
| 91895 |
|
D |
99973 |
| 92050 |
|
D |
100128 |
| 92138 |
|
D |
100216 |
| 92337 |
|
D |
100441 |
| 92338 |
|
D |
100442 |
| 92339 |
|
D |
100443 |
| 92340 |
|
D |
100444 |