Query time 0.00119
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 (90714,90720,90713,90719,90728,90729,90717,90723,90725,90727,90712,90718,90730,90731,90724,90726,90716,90722,89243,89244,89253,89254,90715,90721,90048,90049,90050,90051,90052,90053,90042,90043,90044,90045,90046,90047,90058,90059,87836,93834,93835,93882,93883,93884,93885,96122,96124,96125)) 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 |
| 87836 |
|
D |
95874 |
| 89243 |
|
D |
97281 |
| 89244 |
|
D |
97282 |
| 89253 |
|
D |
97291 |
| 89254 |
|
D |
97292 |
| 90042 |
|
D |
98080 |
| 90043 |
|
D |
98081 |
| 90044 |
|
D |
98082 |
| 90045 |
|
D |
98083 |
| 90046 |
|
D |
98084 |
| 90047 |
|
D |
98085 |
| 90048 |
|
D |
98086 |
| 90049 |
|
D |
98087 |
| 90050 |
|
D |
98088 |
| 90051 |
|
D |
98089 |
| 90052 |
|
D |
98090 |
| 90053 |
|
D |
98091 |
| 90058 |
|
D |
98096 |
| 90059 |
|
D |
98097 |
| 90712 |
|
D |
98764 |
| 90713 |
|
D |
98765 |
| 90714 |
|
D |
98766 |
| 90715 |
|
D |
98767 |
| 90716 |
|
D |
98768 |
| 90717 |
|
D |
98769 |
| 90718 |
|
D |
98770 |
| 90719 |
|
D |
98771 |
| 90720 |
|
D |
98772 |
| 90721 |
|
D |
98773 |
| 90722 |
|
D |
98774 |
| 90723 |
|
D |
98775 |
| 90724 |
|
D |
98776 |
| 90725 |
|
D |
98777 |
| 90726 |
|
D |
98778 |
| 90727 |
|
D |
98779 |
| 90728 |
|
D |
98780 |
| 90729 |
|
D |
98781 |
| 90730 |
|
D |
98782 |
| 90731 |
|
D |
98783 |
| 93834 |
|
B |
101974 |
| 93835 |
|
B |
101975 |
| 93882 |
|
B |
102022 |
| 93883 |
|
B |
102023 |
| 93884 |
|
B |
102024 |
| 93885 |
|
B |
102025 |
| 96122 |
|
B |
104294 |
| 96124 |
|
B |
104296 |
| 96125 |
|
B |
104297 |