Query time 0.00139
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "115.21"
},
"grouping_operation": {
"using_filesort": false,
"nested_loop": [
{
"table": {
"table_name": "cscart_discussion",
"access_type": "range",
"possible_keys": [
"object_id",
"company_id"
],
"key": "object_id",
"used_key_parts": [
"object_id",
"object_type",
"company_id"
],
"key_length": "10",
"rows_examined_per_scan": 24,
"rows_produced_per_join": 24,
"filtered": "100.00",
"index_condition": "((`eshopuga_upgr_4122`.`cscart_discussion`.`company_id` = 1) and (`eshopuga_upgr_4122`.`cscart_discussion`.`object_id` in (1097,1027,1111,1019,1026,1127,1102,1122,1025,1104,1095,1106,1110,1101,1123,1126,1121,1120,1119,1124,1125,1093,1024,1107)) and (`eshopuga_upgr_4122`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "52.81",
"eval_cost": "4.80",
"prefix_cost": "57.61",
"data_read_per_join": "576"
},
"used_columns": [
"thread_id",
"object_id",
"object_type",
"type",
"company_id"
]
}
},
{
"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": [
"eshopuga_upgr_4122.cscart_discussion.thread_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 24,
"filtered": "100.00",
"cost_info": {
"read_cost": "24.00",
"eval_cost": "4.80",
"prefix_cost": "86.41",
"data_read_per_join": "10K"
},
"used_columns": [
"post_id",
"thread_id",
"status"
],
"attached_condition": "<if>(is_not_null_compl(cscart_discussion_posts), (`eshopuga_upgr_4122`.`cscart_discussion_posts`.`status` = 'A'), true)"
}
},
{
"table": {
"table_name": "cscart_discussion_rating",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"thread_id"
],
"key": "PRIMARY",
"used_key_parts": [
"post_id"
],
"key_length": "3",
"ref": [
"eshopuga_upgr_4122.cscart_discussion_posts.post_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 24,
"filtered": "100.00",
"cost_info": {
"read_cost": "24.00",
"eval_cost": "4.80",
"prefix_cost": "115.21",
"data_read_per_join": "384"
},
"used_columns": [
"rating_value",
"post_id",
"thread_id"
],
"attached_condition": "<if>(is_not_null_compl(cscart_discussion_rating), ((`eshopuga_upgr_4122`.`cscart_discussion_rating`.`thread_id` = `eshopuga_upgr_4122`.`cscart_discussion`.`thread_id`) and (`eshopuga_upgr_4122`.`cscart_discussion_rating`.`rating_value` <> 0)), true)"
}
}
]
}
}
}
Result
product_id |
average_rating |
discussion_type |
discussion_thread_id |
1019 |
|
B |
3028 |
1024 |
|
B |
3033 |
1025 |
|
B |
3034 |
1026 |
|
B |
3035 |
1027 |
|
B |
3036 |
1093 |
|
B |
3102 |
1095 |
|
B |
3104 |
1097 |
|
B |
3106 |
1101 |
|
B |
3110 |
1102 |
|
B |
3111 |
1104 |
|
B |
3113 |
1106 |
|
B |
3115 |
1107 |
|
B |
3116 |
1110 |
|
B |
3119 |
1111 |
|
B |
3120 |
1119 |
|
B |
3128 |
1120 |
|
B |
3129 |
1121 |
|
B |
3130 |
1122 |
|
B |
3131 |
1123 |
|
B |
3132 |
1124 |
|
B |
3133 |
1125 |
|
B |
3134 |
1126 |
|
B |
3135 |
1127 |
|
B |
3136 |