Query time 0.00110
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 (85503,86618,86687,88867,88868,88869,88870,88879,88880,88900,88901,89042,90001,85353,85355,83040,84624,84656,90876,90955,83350,83351,83352,83353,89832,89884,89956,91522,85054,85055,85140,85141,85186,85187,85232,85233,82812,82814,82885,82887,82958,82960,83332,83334,83342,83344,84317,85350)) 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 |
| 82812 |
|
D |
90850 |
| 82814 |
|
D |
90852 |
| 82885 |
|
D |
90923 |
| 82887 |
|
D |
90925 |
| 82958 |
|
D |
90996 |
| 82960 |
|
D |
90998 |
| 83040 |
|
D |
91078 |
| 83332 |
|
D |
91370 |
| 83334 |
|
D |
91372 |
| 83342 |
|
D |
91380 |
| 83344 |
|
D |
91382 |
| 83350 |
|
D |
91388 |
| 83351 |
|
D |
91389 |
| 83352 |
|
D |
91390 |
| 83353 |
|
D |
91391 |
| 84317 |
|
D |
92355 |
| 84624 |
|
D |
92662 |
| 84656 |
|
D |
92694 |
| 85054 |
|
D |
93092 |
| 85055 |
|
D |
93093 |
| 85140 |
|
D |
93178 |
| 85141 |
|
D |
93179 |
| 85186 |
|
D |
93224 |
| 85187 |
|
D |
93225 |
| 85232 |
|
D |
93270 |
| 85233 |
|
D |
93271 |
| 85350 |
|
D |
93388 |
| 85353 |
|
D |
93391 |
| 85355 |
|
D |
93393 |
| 85503 |
|
D |
93541 |
| 86618 |
|
D |
94656 |
| 86687 |
|
D |
94725 |
| 88867 |
|
D |
96905 |
| 88868 |
|
D |
96906 |
| 88869 |
|
D |
96907 |
| 88870 |
|
D |
96908 |
| 88879 |
|
D |
96917 |
| 88880 |
|
D |
96918 |
| 88900 |
|
D |
96938 |
| 88901 |
|
D |
96939 |
| 89042 |
|
D |
97080 |
| 89832 |
|
D |
97870 |
| 89884 |
|
D |
97922 |
| 89956 |
|
D |
97994 |
| 90001 |
|
D |
98039 |
| 90876 |
|
D |
98949 |
| 90955 |
|
D |
99028 |
| 91522 |
|
D |
99595 |