Query time 0.00101
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 (87709,87721,87723,87735,88694,88695,88741,88742,88149,88587,84241,87234,87235,87236,87239,87240,87241,87244,87245,87246,87249,87250,87251,84240,88588,84239,84238,84254,84259,87577,87592,87607,88788,90054,90056,90057,84252,84253,84257,84258,87575,87576,87590,87591,87605,87606,88786,88787)) 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 |
| 84238 |
|
D |
92276 |
| 84239 |
|
D |
92277 |
| 84240 |
|
D |
92278 |
| 84241 |
|
D |
92279 |
| 84252 |
|
D |
92290 |
| 84253 |
|
D |
92291 |
| 84254 |
|
D |
92292 |
| 84257 |
|
D |
92295 |
| 84258 |
|
D |
92296 |
| 84259 |
|
D |
92297 |
| 87234 |
|
D |
95272 |
| 87235 |
|
D |
95273 |
| 87236 |
|
D |
95274 |
| 87239 |
|
D |
95277 |
| 87240 |
|
D |
95278 |
| 87241 |
|
D |
95279 |
| 87244 |
|
D |
95282 |
| 87245 |
|
D |
95283 |
| 87246 |
|
D |
95284 |
| 87249 |
|
D |
95287 |
| 87250 |
|
D |
95288 |
| 87251 |
|
D |
95289 |
| 87575 |
|
D |
95613 |
| 87576 |
|
D |
95614 |
| 87577 |
|
D |
95615 |
| 87590 |
|
D |
95628 |
| 87591 |
|
D |
95629 |
| 87592 |
|
D |
95630 |
| 87605 |
|
D |
95643 |
| 87606 |
|
D |
95644 |
| 87607 |
|
D |
95645 |
| 87709 |
|
D |
95747 |
| 87721 |
|
D |
95759 |
| 87723 |
|
D |
95761 |
| 87735 |
|
D |
95773 |
| 88149 |
|
D |
96187 |
| 88587 |
|
D |
96625 |
| 88588 |
|
D |
96626 |
| 88694 |
|
D |
96732 |
| 88695 |
|
D |
96733 |
| 88741 |
|
D |
96779 |
| 88742 |
|
D |
96780 |
| 88786 |
|
D |
96824 |
| 88787 |
|
D |
96825 |
| 88788 |
|
D |
96826 |
| 90054 |
|
D |
98092 |
| 90056 |
|
D |
98094 |
| 90057 |
|
D |
98095 |