Query time 0.00120
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 (93719,93720,93721,93722,93723,93724,93725,93726,93727,93728,93729,93730,93731,93732,93733,93734,93735,93736,93737,93738,93739,93740,93741,93742,93743,93744,93745,93746,93747,93748)) 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 |
| 93719 |
|
B |
101859 |
| 93720 |
|
B |
101860 |
| 93721 |
|
B |
101861 |
| 93722 |
|
B |
101862 |
| 93723 |
|
B |
101863 |
| 93724 |
|
B |
101864 |
| 93725 |
|
B |
101865 |
| 93726 |
|
B |
101866 |
| 93727 |
|
B |
101867 |
| 93728 |
|
B |
101868 |
| 93729 |
|
B |
101869 |
| 93730 |
|
B |
101870 |
| 93731 |
|
B |
101871 |
| 93732 |
|
B |
101872 |
| 93733 |
|
B |
101873 |
| 93734 |
|
B |
101874 |
| 93735 |
|
B |
101875 |
| 93736 |
|
B |
101876 |
| 93737 |
|
B |
101877 |
| 93738 |
|
B |
101878 |
| 93739 |
|
B |
101879 |
| 93740 |
|
B |
101880 |
| 93741 |
|
B |
101881 |
| 93742 |
|
B |
101882 |
| 93743 |
|
B |
101883 |
| 93744 |
|
B |
101884 |
| 93745 |
|
B |
101885 |
| 93746 |
|
B |
101886 |
| 93747 |
|
B |
101887 |
| 93748 |
|
B |
101888 |