Query time 0.00105
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 (92362,92363,92364,85560,85566,85641,89988,91848,91888,85569,91876,85545,92357,84237,85548,92913,92914,92915,92916,92917,92918,92919,92920,92921,93283,93285,93287,93289,93291,93753,93754,93755,93756,93757,93758,93759,93760,93761,93762,93763,93764,93765,93766,93767,93768,93769,93770,93771)) 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 |
| 84237 |
|
D |
92275 |
| 85545 |
|
D |
93583 |
| 85548 |
|
D |
93586 |
| 85560 |
|
D |
93598 |
| 85566 |
|
D |
93604 |
| 85569 |
|
D |
93607 |
| 85641 |
|
D |
93679 |
| 89988 |
|
D |
98026 |
| 91848 |
|
D |
99926 |
| 91876 |
|
D |
99954 |
| 91888 |
|
D |
99966 |
| 92357 |
|
D |
100461 |
| 92362 |
|
D |
100466 |
| 92363 |
|
D |
100467 |
| 92364 |
|
D |
100468 |
| 92913 |
|
B |
101053 |
| 92914 |
|
B |
101054 |
| 92915 |
|
B |
101055 |
| 92916 |
|
B |
101056 |
| 92917 |
|
B |
101057 |
| 92918 |
|
B |
101058 |
| 92919 |
|
B |
101059 |
| 92920 |
|
B |
101060 |
| 92921 |
|
B |
101061 |
| 93283 |
|
B |
101423 |
| 93285 |
|
B |
101425 |
| 93287 |
|
B |
101427 |
| 93289 |
|
B |
101429 |
| 93291 |
|
B |
101431 |
| 93753 |
|
B |
101893 |
| 93754 |
|
B |
101894 |
| 93755 |
|
B |
101895 |
| 93756 |
|
B |
101896 |
| 93757 |
|
B |
101897 |
| 93758 |
|
B |
101898 |
| 93759 |
|
B |
101899 |
| 93760 |
|
B |
101900 |
| 93761 |
|
B |
101901 |
| 93762 |
|
B |
101902 |
| 93763 |
|
B |
101903 |
| 93764 |
|
B |
101904 |
| 93765 |
|
B |
101905 |
| 93766 |
|
B |
101906 |
| 93767 |
|
B |
101907 |
| 93768 |
|
B |
101908 |
| 93769 |
|
B |
101909 |
| 93770 |
|
B |
101910 |
| 93771 |
|
B |
101911 |