Query time 0.00130
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 (90140,90155,82444,84068,84076,87360,82537,84094,90139,90154,87355,87419,82523,90296,90303,82538,83944,84088,82525,90203,90214,87417,84093,85972,90153,90168,82438,87418,90757,90285,90293,82522,90295,90302,84056,84064,82547,82443,91482,82437,87416,90152,90167,85971,84067,84075,82532,84092)) 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 |
| 82437 |
|
D |
90475 |
| 82438 |
|
D |
90476 |
| 82443 |
|
D |
90481 |
| 82444 |
|
D |
90482 |
| 82522 |
|
D |
90560 |
| 82523 |
|
D |
90561 |
| 82525 |
|
D |
90563 |
| 82532 |
|
D |
90570 |
| 82537 |
|
D |
90575 |
| 82538 |
|
D |
90576 |
| 82547 |
|
D |
90585 |
| 83944 |
|
D |
91982 |
| 84056 |
|
D |
92094 |
| 84064 |
|
D |
92102 |
| 84067 |
|
D |
92105 |
| 84068 |
|
D |
92106 |
| 84075 |
|
D |
92113 |
| 84076 |
|
D |
92114 |
| 84088 |
|
D |
92126 |
| 84092 |
|
D |
92130 |
| 84093 |
|
D |
92131 |
| 84094 |
|
D |
92132 |
| 85971 |
|
D |
94009 |
| 85972 |
|
D |
94010 |
| 87355 |
|
D |
95393 |
| 87360 |
|
D |
95398 |
| 87416 |
|
D |
95454 |
| 87417 |
|
D |
95455 |
| 87418 |
|
D |
95456 |
| 87419 |
|
D |
95457 |
| 90139 |
|
D |
98177 |
| 90140 |
|
D |
98178 |
| 90152 |
|
D |
98190 |
| 90153 |
|
D |
98191 |
| 90154 |
|
D |
98192 |
| 90155 |
|
D |
98193 |
| 90167 |
|
D |
98205 |
| 90168 |
|
D |
98206 |
| 90203 |
|
D |
98241 |
| 90214 |
|
D |
98252 |
| 90285 |
|
D |
98323 |
| 90293 |
|
D |
98331 |
| 90295 |
|
D |
98333 |
| 90296 |
|
D |
98334 |
| 90302 |
|
D |
98340 |
| 90303 |
|
D |
98341 |
| 90757 |
|
D |
98810 |
| 91482 |
|
D |
99555 |