Query time 0.00091
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "40.51"
},
"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": 35,
"rows_produced_per_join": 35,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (94907,94916,94917,94919,94920,94945,94946,96250,96251,96260,96261,96263,96264,96290,96291,96576,96581,96598,96599,100550,100559,100560,100562,100563,100589,100590,101579,101580,101589,101590,101592,101593,101619,101620,101624)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "21.01",
"eval_cost": "3.50",
"prefix_cost": "24.51",
"data_read_per_join": "840"
},
"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": 35,
"filtered": "100.00",
"cost_info": {
"read_cost": "8.75",
"eval_cost": "3.50",
"prefix_cost": "36.76",
"data_read_per_join": "15K"
},
"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": 35,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "3.50",
"prefix_cost": "40.51",
"data_read_per_join": "560"
},
"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 |
| 94907 |
|
B |
103079 |
| 94916 |
|
B |
103088 |
| 94917 |
|
B |
103089 |
| 94919 |
|
B |
103091 |
| 94920 |
|
B |
103092 |
| 94945 |
|
B |
103117 |
| 94946 |
|
B |
103118 |
| 96250 |
|
B |
104422 |
| 96251 |
|
B |
104423 |
| 96260 |
|
B |
104432 |
| 96261 |
|
B |
104433 |
| 96263 |
|
B |
104435 |
| 96264 |
|
B |
104436 |
| 96290 |
|
B |
104462 |
| 96291 |
|
B |
104463 |
| 96576 |
|
B |
104757 |
| 96581 |
|
B |
104762 |
| 96598 |
|
B |
104779 |
| 96599 |
|
B |
104780 |
| 100550 |
|
B |
108730 |
| 100559 |
|
B |
108739 |
| 100560 |
|
B |
108740 |
| 100562 |
|
B |
108742 |
| 100563 |
|
B |
108743 |
| 100589 |
|
B |
108769 |
| 100590 |
|
B |
108770 |
| 101579 |
|
B |
109762 |
| 101580 |
|
B |
109763 |
| 101589 |
|
B |
109772 |
| 101590 |
|
B |
109773 |
| 101592 |
|
B |
109775 |
| 101593 |
|
B |
109776 |
| 101619 |
|
B |
109802 |
| 101620 |
|
B |
109803 |
| 101624 |
|
B |
109807 |