Query time 0.00093
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 (98847,98848,98849,98850,98914,98915,98916,98917,98918,98919,98920,98921,98922,98923,98924,98925,98926,98927,98928,98929,98930,98931,98932,98933,98934,98935,98936,98937,98938,98939)) 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 |
| 98847 |
|
B |
107028 |
| 98848 |
|
B |
107029 |
| 98849 |
|
B |
107030 |
| 98850 |
|
B |
107031 |
| 98914 |
|
B |
107095 |
| 98915 |
|
B |
107096 |
| 98916 |
|
B |
107097 |
| 98917 |
|
B |
107098 |
| 98918 |
|
B |
107099 |
| 98919 |
|
B |
107100 |
| 98920 |
|
B |
107101 |
| 98921 |
|
B |
107102 |
| 98922 |
|
B |
107103 |
| 98923 |
|
B |
107104 |
| 98924 |
|
B |
107105 |
| 98925 |
|
B |
107106 |
| 98926 |
|
B |
107107 |
| 98927 |
|
B |
107108 |
| 98928 |
|
B |
107109 |
| 98929 |
|
B |
107110 |
| 98930 |
|
B |
107111 |
| 98931 |
|
B |
107112 |
| 98932 |
|
B |
107113 |
| 98933 |
|
B |
107114 |
| 98934 |
|
B |
107115 |
| 98935 |
|
B |
107116 |
| 98936 |
|
B |
107117 |
| 98937 |
|
B |
107118 |
| 98938 |
|
B |
107119 |
| 98939 |
|
B |
107120 |