Query time 0.00066
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 (91846,91847,86891,91868,91849,91850,91851,91852,91853,91854,91855,91857,91858,91859,91860,91861,91862,91863,92227,82402,92210,85577,92373,92383,92384,92385,92386,92387,92388,92389,91889,91890,91891,92333,92334,92335,92336,86888,92365,86890,91864,92374,85576,85584,85572,86900,85592,85546)) 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 |
| 82402 |
|
D |
90440 |
| 85546 |
|
D |
93584 |
| 85572 |
|
D |
93610 |
| 85576 |
|
D |
93614 |
| 85577 |
|
D |
93615 |
| 85584 |
|
D |
93622 |
| 85592 |
|
D |
93630 |
| 86888 |
|
D |
94926 |
| 86890 |
|
D |
94928 |
| 86891 |
|
D |
94929 |
| 86900 |
|
D |
94938 |
| 91846 |
|
D |
99924 |
| 91847 |
|
D |
99925 |
| 91849 |
|
D |
99927 |
| 91850 |
|
D |
99928 |
| 91851 |
|
D |
99929 |
| 91852 |
|
D |
99930 |
| 91853 |
|
D |
99931 |
| 91854 |
|
D |
99932 |
| 91855 |
|
D |
99933 |
| 91857 |
|
D |
99935 |
| 91858 |
|
D |
99936 |
| 91859 |
|
D |
99937 |
| 91860 |
|
D |
99938 |
| 91861 |
|
D |
99939 |
| 91862 |
|
D |
99940 |
| 91863 |
|
D |
99941 |
| 91864 |
|
D |
99942 |
| 91868 |
|
D |
99946 |
| 91889 |
|
D |
99967 |
| 91890 |
|
D |
99968 |
| 91891 |
|
D |
99969 |
| 92210 |
|
D |
100288 |
| 92227 |
|
D |
100305 |
| 92333 |
|
D |
100437 |
| 92334 |
|
D |
100438 |
| 92335 |
|
D |
100439 |
| 92336 |
|
D |
100440 |
| 92365 |
|
D |
100469 |
| 92373 |
|
D |
100477 |
| 92374 |
|
D |
100478 |
| 92383 |
|
D |
100487 |
| 92384 |
|
D |
100488 |
| 92385 |
|
D |
100489 |
| 92386 |
|
D |
100490 |
| 92387 |
|
D |
100491 |
| 92388 |
|
D |
100492 |
| 92389 |
|
D |
100493 |