Query time 0.00045
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 (88768,88940,88449,88466,88482,88690,88737,84703,84706,88082,91053,87616,87624,90815,88941,89102,89108,89110,89115,87958,88068,88675,88722,88067,88512,88548,88590,88591,88592,90834,88447,88464,88480,88691,88738,87548,88141,88144,88767,90829,88939,89017,88547,88583,88674,88721,88582,90833)) 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 |
| 84703 |
|
D |
92741 |
| 84706 |
|
D |
92744 |
| 87548 |
|
D |
95586 |
| 87616 |
|
D |
95654 |
| 87624 |
|
D |
95662 |
| 87958 |
|
D |
95996 |
| 88067 |
|
D |
96105 |
| 88068 |
|
D |
96106 |
| 88082 |
|
D |
96120 |
| 88141 |
|
D |
96179 |
| 88144 |
|
D |
96182 |
| 88447 |
|
D |
96485 |
| 88449 |
|
D |
96487 |
| 88464 |
|
D |
96502 |
| 88466 |
|
D |
96504 |
| 88480 |
|
D |
96518 |
| 88482 |
|
D |
96520 |
| 88512 |
|
D |
96550 |
| 88547 |
|
D |
96585 |
| 88548 |
|
D |
96586 |
| 88582 |
|
D |
96620 |
| 88583 |
|
D |
96621 |
| 88590 |
|
D |
96628 |
| 88591 |
|
D |
96629 |
| 88592 |
|
D |
96630 |
| 88674 |
|
D |
96712 |
| 88675 |
|
D |
96713 |
| 88690 |
|
D |
96728 |
| 88691 |
|
D |
96729 |
| 88721 |
|
D |
96759 |
| 88722 |
|
D |
96760 |
| 88737 |
|
D |
96775 |
| 88738 |
|
D |
96776 |
| 88767 |
|
D |
96805 |
| 88768 |
|
D |
96806 |
| 88939 |
|
D |
96977 |
| 88940 |
|
D |
96978 |
| 88941 |
|
D |
96979 |
| 89017 |
|
D |
97055 |
| 89102 |
|
D |
97140 |
| 89108 |
|
D |
97146 |
| 89110 |
|
D |
97148 |
| 89115 |
|
D |
97153 |
| 90815 |
|
D |
98868 |
| 90829 |
|
D |
98882 |
| 90833 |
|
D |
98886 |
| 90834 |
|
D |
98887 |
| 91053 |
|
D |
99126 |