Query time 0.00120
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 (83026,83027,90862,90863,90941,90942,86485,86654,86723,86761,82809,82882,82955,83329,83339,85094,85095,82628,82629,82793,82794,82866,82867,82939,82940,83151,83152,83156,83157,83493,83494,91067,91086,91087,91172,91173,91227,91228,83549,83554,86491,86767,89748,84318,85305,85402,85453,85504)) 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 |
| 82628 |
|
D |
90666 |
| 82629 |
|
D |
90667 |
| 82793 |
|
D |
90831 |
| 82794 |
|
D |
90832 |
| 82809 |
|
D |
90847 |
| 82866 |
|
D |
90904 |
| 82867 |
|
D |
90905 |
| 82882 |
|
D |
90920 |
| 82939 |
|
D |
90977 |
| 82940 |
|
D |
90978 |
| 82955 |
|
D |
90993 |
| 83026 |
|
D |
91064 |
| 83027 |
|
D |
91065 |
| 83151 |
|
D |
91189 |
| 83152 |
|
D |
91190 |
| 83156 |
|
D |
91194 |
| 83157 |
|
D |
91195 |
| 83329 |
|
D |
91367 |
| 83339 |
|
D |
91377 |
| 83493 |
|
D |
91531 |
| 83494 |
|
D |
91532 |
| 83549 |
|
D |
91587 |
| 83554 |
|
D |
91592 |
| 84318 |
|
D |
92356 |
| 85094 |
|
D |
93132 |
| 85095 |
|
D |
93133 |
| 85305 |
|
D |
93343 |
| 85402 |
|
D |
93440 |
| 85453 |
|
D |
93491 |
| 85504 |
|
D |
93542 |
| 86485 |
|
D |
94523 |
| 86491 |
|
D |
94529 |
| 86654 |
|
D |
94692 |
| 86723 |
|
D |
94761 |
| 86761 |
|
D |
94799 |
| 86767 |
|
D |
94805 |
| 89748 |
|
D |
97786 |
| 90862 |
|
D |
98935 |
| 90863 |
|
D |
98936 |
| 90941 |
|
D |
99014 |
| 90942 |
|
D |
99015 |
| 91067 |
|
D |
99140 |
| 91086 |
|
D |
99159 |
| 91087 |
|
D |
99160 |
| 91172 |
|
D |
99245 |
| 91173 |
|
D |
99246 |
| 91227 |
|
D |
99300 |
| 91228 |
|
D |
99301 |