Query time 0.00133
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "55.46"
},
"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": 48,
"rows_produced_per_join": 48,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (98852,98853,98854,98855,98856,98857,98858,99133,99141,99142,99151,99152,99169,99170,99248,99257,99262,99322,99323,99404,99405,99406,99407,99408,99409,99410,99411,100392,100433,100437,100677,100678,100679,100680,100681,100682,100683,100684,100685,100686,100687,100688,100689,100690,100691,100692,100693,100694)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "28.81",
"eval_cost": "4.80",
"prefix_cost": "33.61",
"data_read_per_join": "1K"
},
"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": 48,
"filtered": "100.00",
"cost_info": {
"read_cost": "12.00",
"eval_cost": "4.80",
"prefix_cost": "50.41",
"data_read_per_join": "21K"
},
"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": 48,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "4.80",
"prefix_cost": "55.46",
"data_read_per_join": "768"
},
"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 |
| 98852 |
|
B |
107033 |
| 98853 |
|
B |
107034 |
| 98854 |
|
B |
107035 |
| 98855 |
|
B |
107036 |
| 98856 |
|
B |
107037 |
| 98857 |
|
B |
107038 |
| 98858 |
|
B |
107039 |
| 99133 |
|
B |
107314 |
| 99141 |
|
B |
107322 |
| 99142 |
|
B |
107323 |
| 99151 |
|
B |
107332 |
| 99152 |
|
B |
107333 |
| 99169 |
|
B |
107350 |
| 99170 |
|
B |
107351 |
| 99248 |
|
B |
107429 |
| 99257 |
|
B |
107438 |
| 99262 |
|
B |
107443 |
| 99322 |
|
B |
107503 |
| 99323 |
|
B |
107504 |
| 99404 |
|
B |
107585 |
| 99405 |
|
B |
107586 |
| 99406 |
|
B |
107587 |
| 99407 |
|
B |
107588 |
| 99408 |
|
B |
107589 |
| 99409 |
|
B |
107590 |
| 99410 |
|
B |
107591 |
| 99411 |
|
B |
107592 |
| 100392 |
|
B |
108572 |
| 100433 |
|
B |
108613 |
| 100437 |
|
B |
108617 |
| 100677 |
|
B |
108857 |
| 100678 |
|
B |
108858 |
| 100679 |
|
B |
108859 |
| 100680 |
|
B |
108860 |
| 100681 |
|
B |
108861 |
| 100682 |
|
B |
108862 |
| 100683 |
|
B |
108863 |
| 100684 |
|
B |
108864 |
| 100685 |
|
B |
108865 |
| 100686 |
|
B |
108866 |
| 100687 |
|
B |
108867 |
| 100688 |
|
B |
108868 |
| 100689 |
|
B |
108869 |
| 100690 |
|
B |
108870 |
| 100691 |
|
B |
108871 |
| 100692 |
|
B |
108872 |
| 100693 |
|
B |
108873 |
| 100694 |
|
B |
108874 |