Query time 0.00109
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "34.76"
},
"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": 30,
"rows_produced_per_join": 30,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (91055,91058,84858,91735,91736,91737,91738,91739,91740,91741,91742,91743,91744,91745,91746,91747,91748,91749,91750,91751,91752,91753,91754,91816,91817,91818,91819,91820,91821,91822)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "18.01",
"eval_cost": "3.00",
"prefix_cost": "21.01",
"data_read_per_join": "720"
},
"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": 30,
"filtered": "100.00",
"cost_info": {
"read_cost": "7.50",
"eval_cost": "3.00",
"prefix_cost": "31.51",
"data_read_per_join": "13K"
},
"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": 30,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "3.00",
"prefix_cost": "34.76",
"data_read_per_join": "480"
},
"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 |
| 84858 |
|
D |
92896 |
| 91055 |
|
D |
99128 |
| 91058 |
|
D |
99131 |
| 91735 |
|
D |
99808 |
| 91736 |
|
D |
99809 |
| 91737 |
|
D |
99810 |
| 91738 |
|
D |
99811 |
| 91739 |
|
D |
99812 |
| 91740 |
|
D |
99813 |
| 91741 |
|
D |
99814 |
| 91742 |
|
D |
99815 |
| 91743 |
|
D |
99816 |
| 91744 |
|
D |
99817 |
| 91745 |
|
D |
99818 |
| 91746 |
|
D |
99819 |
| 91747 |
|
D |
99820 |
| 91748 |
|
D |
99821 |
| 91749 |
|
D |
99822 |
| 91750 |
|
D |
99823 |
| 91751 |
|
D |
99824 |
| 91752 |
|
D |
99825 |
| 91753 |
|
D |
99826 |
| 91754 |
|
D |
99827 |
| 91816 |
|
D |
99894 |
| 91817 |
|
D |
99895 |
| 91818 |
|
D |
99896 |
| 91819 |
|
D |
99897 |
| 91820 |
|
D |
99898 |
| 91821 |
|
D |
99899 |
| 91822 |
|
D |
99900 |