Query time 0.00091
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 (96602,96603,96604,96605,96606,96607,96608,96609,96610,96611,96612,96613,96614,96615,96616,96617,96618,96619,96620,96621,96622,96623,96624,96625,96626,96627,96628,96629,96668,96669)) 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 |
| 96602 |
|
B |
104783 |
| 96603 |
|
B |
104784 |
| 96604 |
|
B |
104785 |
| 96605 |
|
B |
104786 |
| 96606 |
|
B |
104787 |
| 96607 |
|
B |
104788 |
| 96608 |
|
B |
104789 |
| 96609 |
|
B |
104790 |
| 96610 |
|
B |
104791 |
| 96611 |
|
B |
104792 |
| 96612 |
|
B |
104793 |
| 96613 |
|
B |
104794 |
| 96614 |
|
B |
104795 |
| 96615 |
|
B |
104796 |
| 96616 |
|
B |
104797 |
| 96617 |
|
B |
104798 |
| 96618 |
|
B |
104799 |
| 96619 |
|
B |
104800 |
| 96620 |
|
B |
104801 |
| 96621 |
|
B |
104802 |
| 96622 |
|
B |
104803 |
| 96623 |
|
B |
104804 |
| 96624 |
|
B |
104805 |
| 96625 |
|
B |
104806 |
| 96626 |
|
B |
104807 |
| 96627 |
|
B |
104808 |
| 96628 |
|
B |
104809 |
| 96629 |
|
B |
104810 |
| 96668 |
|
B |
104849 |
| 96669 |
|
B |
104850 |