Query time 0.00095
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 (99735,99736,99737,99738,99739,99740,99741,99742,99743,99744,99745,99746,99747,99748,99749,99750,99751,99752,99753,99754,99755,99756,99757,99758,99759,99760,99761,99762,99763,99764)) 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 |
| 99735 |
|
B |
107915 |
| 99736 |
|
B |
107916 |
| 99737 |
|
B |
107917 |
| 99738 |
|
B |
107918 |
| 99739 |
|
B |
107919 |
| 99740 |
|
B |
107920 |
| 99741 |
|
B |
107921 |
| 99742 |
|
B |
107922 |
| 99743 |
|
B |
107923 |
| 99744 |
|
B |
107924 |
| 99745 |
|
B |
107925 |
| 99746 |
|
B |
107926 |
| 99747 |
|
B |
107927 |
| 99748 |
|
B |
107928 |
| 99749 |
|
B |
107929 |
| 99750 |
|
B |
107930 |
| 99751 |
|
B |
107931 |
| 99752 |
|
B |
107932 |
| 99753 |
|
B |
107933 |
| 99754 |
|
B |
107934 |
| 99755 |
|
B |
107935 |
| 99756 |
|
B |
107936 |
| 99757 |
|
B |
107937 |
| 99758 |
|
B |
107938 |
| 99759 |
|
B |
107939 |
| 99760 |
|
B |
107940 |
| 99761 |
|
B |
107941 |
| 99762 |
|
B |
107942 |
| 99763 |
|
B |
107943 |
| 99764 |
|
B |
107944 |