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 (88961,85800,82352,91937,91939,91940,91941,91942,91943,88957,88958,85644,88942,86856,88969,88970,88973,88974,87280,87288,85580,86863,82386,88094,89442,89444,88967,88968,88971,88972,88955,88956,92151,92152,92153,92353,92354,92355,92356,88953,88954,87879,82403,82410,82424,91893,91894,91895)) 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 |
| 82352 |
|
D |
90390 |
| 82386 |
|
D |
90424 |
| 82403 |
|
D |
90441 |
| 82410 |
|
D |
90448 |
| 82424 |
|
D |
90462 |
| 85580 |
|
D |
93618 |
| 85644 |
|
D |
93682 |
| 85800 |
|
D |
93838 |
| 86856 |
|
D |
94894 |
| 86863 |
|
D |
94901 |
| 87280 |
|
D |
95318 |
| 87288 |
|
D |
95326 |
| 87879 |
|
D |
95917 |
| 88094 |
|
D |
96132 |
| 88942 |
|
D |
96980 |
| 88953 |
|
D |
96991 |
| 88954 |
|
D |
96992 |
| 88955 |
|
D |
96993 |
| 88956 |
|
D |
96994 |
| 88957 |
|
D |
96995 |
| 88958 |
|
D |
96996 |
| 88961 |
|
D |
96999 |
| 88967 |
|
D |
97005 |
| 88968 |
|
D |
97006 |
| 88969 |
|
D |
97007 |
| 88970 |
|
D |
97008 |
| 88971 |
|
D |
97009 |
| 88972 |
|
D |
97010 |
| 88973 |
|
D |
97011 |
| 88974 |
|
D |
97012 |
| 89442 |
|
D |
97480 |
| 89444 |
|
D |
97482 |
| 91893 |
|
D |
99971 |
| 91894 |
|
D |
99972 |
| 91895 |
|
D |
99973 |
| 91937 |
|
D |
100015 |
| 91939 |
|
D |
100017 |
| 91940 |
|
D |
100018 |
| 91941 |
|
D |
100019 |
| 91942 |
|
D |
100020 |
| 91943 |
|
D |
100021 |
| 92151 |
|
D |
100229 |
| 92152 |
|
D |
100230 |
| 92153 |
|
D |
100231 |
| 92353 |
|
D |
100457 |
| 92354 |
|
D |
100458 |
| 92355 |
|
D |
100459 |
| 92356 |
|
D |
100460 |