Query time 0.00058
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 (94882,94883,94884,94885,94886,94887,94888,94889,94890,94891,94892,94893,94894,94895,94896,94897,94898,94899,94900,94901,94902,94903,94904,94905,94906,94907,94908,94909,94910,94911,94912,94913,94914,94915,94916,94917,94918,94919,94920,94921,94922,94923,94924,94925,94926,94927,94928,94929)) 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 |
| 94882 |
|
B |
103054 |
| 94883 |
|
B |
103055 |
| 94884 |
|
B |
103056 |
| 94885 |
|
B |
103057 |
| 94886 |
|
B |
103058 |
| 94887 |
|
B |
103059 |
| 94888 |
|
B |
103060 |
| 94889 |
|
B |
103061 |
| 94890 |
|
B |
103062 |
| 94891 |
|
B |
103063 |
| 94892 |
|
B |
103064 |
| 94893 |
|
B |
103065 |
| 94894 |
|
B |
103066 |
| 94895 |
|
B |
103067 |
| 94896 |
|
B |
103068 |
| 94897 |
|
B |
103069 |
| 94898 |
|
B |
103070 |
| 94899 |
|
B |
103071 |
| 94900 |
|
B |
103072 |
| 94901 |
|
B |
103073 |
| 94902 |
|
B |
103074 |
| 94903 |
|
B |
103075 |
| 94904 |
|
B |
103076 |
| 94905 |
|
B |
103077 |
| 94906 |
|
B |
103078 |
| 94907 |
|
B |
103079 |
| 94908 |
|
B |
103080 |
| 94909 |
|
B |
103081 |
| 94910 |
|
B |
103082 |
| 94911 |
|
B |
103083 |
| 94912 |
|
B |
103084 |
| 94913 |
|
B |
103085 |
| 94914 |
|
B |
103086 |
| 94915 |
|
B |
103087 |
| 94916 |
|
B |
103088 |
| 94917 |
|
B |
103089 |
| 94918 |
|
B |
103090 |
| 94919 |
|
B |
103091 |
| 94920 |
|
B |
103092 |
| 94921 |
|
B |
103093 |
| 94922 |
|
B |
103094 |
| 94923 |
|
B |
103095 |
| 94924 |
|
B |
103096 |
| 94925 |
|
B |
103097 |
| 94926 |
|
B |
103098 |
| 94927 |
|
B |
103099 |
| 94928 |
|
B |
103100 |
| 94929 |
|
B |
103101 |