Query time 0.00107
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 (93871,94381,95557,95944,96778,96779,96780,96791,96839,96840,98192,98193,98194,98195,98196,98197,98198,98199,98208,98209,98210,98211,98212,98213,98214,98215,98216,98217,98218,98219,98220,98221,98222,98223,98322,98323,98563,98564,98565,98566,98567,98568,98569,99519,99520,99521,99522,99523)) 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 |
| 93871 |
|
B |
102011 |
| 94381 |
|
B |
102523 |
| 95557 |
|
B |
103729 |
| 95944 |
|
B |
104116 |
| 96778 |
|
B |
104959 |
| 96779 |
|
B |
104960 |
| 96780 |
|
B |
104961 |
| 96791 |
|
B |
104972 |
| 96839 |
|
B |
105020 |
| 96840 |
|
B |
105021 |
| 98192 |
|
B |
106373 |
| 98193 |
|
B |
106374 |
| 98194 |
|
B |
106375 |
| 98195 |
|
B |
106376 |
| 98196 |
|
B |
106377 |
| 98197 |
|
B |
106378 |
| 98198 |
|
B |
106379 |
| 98199 |
|
B |
106380 |
| 98208 |
|
B |
106389 |
| 98209 |
|
B |
106390 |
| 98210 |
|
B |
106391 |
| 98211 |
|
B |
106392 |
| 98212 |
|
B |
106393 |
| 98213 |
|
B |
106394 |
| 98214 |
|
B |
106395 |
| 98215 |
|
B |
106396 |
| 98216 |
|
B |
106397 |
| 98217 |
|
B |
106398 |
| 98218 |
|
B |
106399 |
| 98219 |
|
B |
106400 |
| 98220 |
|
B |
106401 |
| 98221 |
|
B |
106402 |
| 98222 |
|
B |
106403 |
| 98223 |
|
B |
106404 |
| 98322 |
|
B |
106503 |
| 98323 |
|
B |
106504 |
| 98563 |
|
B |
106744 |
| 98564 |
|
B |
106745 |
| 98565 |
|
B |
106746 |
| 98566 |
|
B |
106747 |
| 98567 |
|
B |
106748 |
| 98568 |
|
B |
106749 |
| 98569 |
|
B |
106750 |
| 99519 |
|
B |
107700 |
| 99520 |
|
B |
107701 |
| 99521 |
|
B |
107702 |
| 99522 |
|
B |
107703 |
| 99523 |
|
B |
107704 |