Query time 0.00100
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 (92835,92836,92837,92844,92845,92846,92847,92848,92849,92850,92851,92852,92853,92854,92855,92856,92857,92858,92859,92860,92861,92862,92863,92864,92865,92866,92867,92868,92869,92870,92871,92872,92873,92874,92875,92876,92877,92878,92879,92880,92881,92882,92883,92884,92885,92886,92887,92888)) 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 |
| 92835 |
|
B |
100975 |
| 92836 |
|
B |
100976 |
| 92837 |
|
B |
100977 |
| 92844 |
|
B |
100984 |
| 92845 |
|
B |
100985 |
| 92846 |
|
B |
100986 |
| 92847 |
|
B |
100987 |
| 92848 |
|
B |
100988 |
| 92849 |
|
B |
100989 |
| 92850 |
|
B |
100990 |
| 92851 |
|
B |
100991 |
| 92852 |
|
B |
100992 |
| 92853 |
|
B |
100993 |
| 92854 |
|
B |
100994 |
| 92855 |
|
B |
100995 |
| 92856 |
|
B |
100996 |
| 92857 |
|
B |
100997 |
| 92858 |
|
B |
100998 |
| 92859 |
|
B |
100999 |
| 92860 |
|
B |
101000 |
| 92861 |
|
B |
101001 |
| 92862 |
|
B |
101002 |
| 92863 |
|
B |
101003 |
| 92864 |
|
B |
101004 |
| 92865 |
|
B |
101005 |
| 92866 |
|
B |
101006 |
| 92867 |
|
B |
101007 |
| 92868 |
|
B |
101008 |
| 92869 |
|
B |
101009 |
| 92870 |
|
B |
101010 |
| 92871 |
|
B |
101011 |
| 92872 |
|
B |
101012 |
| 92873 |
|
B |
101013 |
| 92874 |
|
B |
101014 |
| 92875 |
|
B |
101015 |
| 92876 |
|
B |
101016 |
| 92877 |
|
B |
101017 |
| 92878 |
|
B |
101018 |
| 92879 |
|
B |
101019 |
| 92880 |
|
B |
101020 |
| 92881 |
|
B |
101021 |
| 92882 |
|
B |
101022 |
| 92883 |
|
B |
101023 |
| 92884 |
|
B |
101024 |
| 92885 |
|
B |
101025 |
| 92886 |
|
B |
101026 |
| 92887 |
|
B |
101027 |
| 92888 |
|
B |
101028 |