Query time 0.00122
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 (91617,91618,83879,83881,83887,91787,91796,91797,91798,91799,91800,91801,91802,91803,87870,83894,91622,91698,83885,83888,91626,87867,87868,87869,91620,91540,91541,91542,91543,91544,91545,91546,91547,91548,91549,91624,91804,91805,91806,91807,91808,91809,91810,91811,91621,91601,91602,91603)) 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 |
| 83879 |
|
D |
91917 |
| 83881 |
|
D |
91919 |
| 83885 |
|
D |
91923 |
| 83887 |
|
D |
91925 |
| 83888 |
|
D |
91926 |
| 83894 |
|
D |
91932 |
| 87867 |
|
D |
95905 |
| 87868 |
|
D |
95906 |
| 87869 |
|
D |
95907 |
| 87870 |
|
D |
95908 |
| 91540 |
|
D |
99613 |
| 91541 |
|
D |
99614 |
| 91542 |
|
D |
99615 |
| 91543 |
|
D |
99616 |
| 91544 |
|
D |
99617 |
| 91545 |
|
D |
99618 |
| 91546 |
|
D |
99619 |
| 91547 |
|
D |
99620 |
| 91548 |
|
D |
99621 |
| 91549 |
|
D |
99622 |
| 91601 |
|
D |
99674 |
| 91602 |
|
D |
99675 |
| 91603 |
|
D |
99676 |
| 91617 |
|
D |
99690 |
| 91618 |
|
D |
99691 |
| 91620 |
|
D |
99693 |
| 91621 |
|
D |
99694 |
| 91622 |
|
D |
99695 |
| 91624 |
|
D |
99697 |
| 91626 |
|
D |
99699 |
| 91698 |
|
D |
99771 |
| 91787 |
|
D |
99865 |
| 91796 |
|
D |
99874 |
| 91797 |
|
D |
99875 |
| 91798 |
|
D |
99876 |
| 91799 |
|
D |
99877 |
| 91800 |
|
D |
99878 |
| 91801 |
|
D |
99879 |
| 91802 |
|
D |
99880 |
| 91803 |
|
D |
99881 |
| 91804 |
|
D |
99882 |
| 91805 |
|
D |
99883 |
| 91806 |
|
D |
99884 |
| 91807 |
|
D |
99885 |
| 91808 |
|
D |
99886 |
| 91809 |
|
D |
99887 |
| 91810 |
|
D |
99888 |
| 91811 |
|
D |
99889 |