Query time 0.00092
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 (87296,87297,85852,85853,85862,85863,91007,91008,91019,91020,91031,91032,91044,91045,85842,85843,91004,91005,91016,91017,91028,91029,91040,91041,91042,90008,90564,90570,90576,84678,87304,87305,87316,87317,87328,87329,87340,87341,89818,89819,89870,89871,89942,89943,91508,91509,83083,83084)) 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 |
| 83083 |
|
D |
91121 |
| 83084 |
|
D |
91122 |
| 84678 |
|
D |
92716 |
| 85842 |
|
D |
93880 |
| 85843 |
|
D |
93881 |
| 85852 |
|
D |
93890 |
| 85853 |
|
D |
93891 |
| 85862 |
|
D |
93900 |
| 85863 |
|
D |
93901 |
| 87296 |
|
D |
95334 |
| 87297 |
|
D |
95335 |
| 87304 |
|
D |
95342 |
| 87305 |
|
D |
95343 |
| 87316 |
|
D |
95354 |
| 87317 |
|
D |
95355 |
| 87328 |
|
D |
95366 |
| 87329 |
|
D |
95367 |
| 87340 |
|
D |
95378 |
| 87341 |
|
D |
95379 |
| 89818 |
|
D |
97856 |
| 89819 |
|
D |
97857 |
| 89870 |
|
D |
97908 |
| 89871 |
|
D |
97909 |
| 89942 |
|
D |
97980 |
| 89943 |
|
D |
97981 |
| 90008 |
|
D |
98046 |
| 90564 |
|
D |
98616 |
| 90570 |
|
D |
98622 |
| 90576 |
|
D |
98628 |
| 91004 |
|
D |
99077 |
| 91005 |
|
D |
99078 |
| 91007 |
|
D |
99080 |
| 91008 |
|
D |
99081 |
| 91016 |
|
D |
99089 |
| 91017 |
|
D |
99090 |
| 91019 |
|
D |
99092 |
| 91020 |
|
D |
99093 |
| 91028 |
|
D |
99101 |
| 91029 |
|
D |
99102 |
| 91031 |
|
D |
99104 |
| 91032 |
|
D |
99105 |
| 91040 |
|
D |
99113 |
| 91041 |
|
D |
99114 |
| 91042 |
|
D |
99115 |
| 91044 |
|
D |
99117 |
| 91045 |
|
D |
99118 |
| 91508 |
|
D |
99581 |
| 91509 |
|
D |
99582 |