Query time 0.00092
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 (93932,93933,93934,93935,93936,93937,93938,93939,93940,93941,93942,93943,93944,93945,93946,93947,93948,93949,93950,93951,93952,93953,93954,93955,93956,93957,93958,93959,93960,93961)) 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 |
| 93932 |
|
B |
102072 |
| 93933 |
|
B |
102073 |
| 93934 |
|
B |
102074 |
| 93935 |
|
B |
102075 |
| 93936 |
|
B |
102076 |
| 93937 |
|
B |
102077 |
| 93938 |
|
B |
102078 |
| 93939 |
|
B |
102079 |
| 93940 |
|
B |
102080 |
| 93941 |
|
B |
102081 |
| 93942 |
|
B |
102082 |
| 93943 |
|
B |
102083 |
| 93944 |
|
B |
102084 |
| 93945 |
|
B |
102085 |
| 93946 |
|
B |
102086 |
| 93947 |
|
B |
102087 |
| 93948 |
|
B |
102088 |
| 93949 |
|
B |
102089 |
| 93950 |
|
B |
102090 |
| 93951 |
|
B |
102091 |
| 93952 |
|
B |
102092 |
| 93953 |
|
B |
102093 |
| 93954 |
|
B |
102094 |
| 93955 |
|
B |
102095 |
| 93956 |
|
B |
102096 |
| 93957 |
|
B |
102097 |
| 93958 |
|
B |
102098 |
| 93959 |
|
B |
102099 |
| 93960 |
|
B |
102100 |
| 93961 |
|
B |
102101 |