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 (100485,100486,100700,100701,100702,100703,100704,100705,100706,100707,100708,100709,100710,100711,100712,100713,100714,100715,100716,100717,100718,100719,100720,100721,100722,100723,100724,100725,100726,100727)) 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 |
| 100485 |
|
B |
108665 |
| 100486 |
|
B |
108666 |
| 100700 |
|
B |
108880 |
| 100701 |
|
B |
108881 |
| 100702 |
|
B |
108882 |
| 100703 |
|
B |
108883 |
| 100704 |
|
B |
108884 |
| 100705 |
|
B |
108885 |
| 100706 |
|
B |
108886 |
| 100707 |
|
B |
108887 |
| 100708 |
|
B |
108888 |
| 100709 |
|
B |
108889 |
| 100710 |
|
B |
108890 |
| 100711 |
|
B |
108891 |
| 100712 |
|
B |
108892 |
| 100713 |
|
B |
108893 |
| 100714 |
|
B |
108894 |
| 100715 |
|
B |
108895 |
| 100716 |
|
B |
108896 |
| 100717 |
|
B |
108897 |
| 100718 |
|
B |
108898 |
| 100719 |
|
B |
108899 |
| 100720 |
|
B |
108900 |
| 100721 |
|
B |
108901 |
| 100722 |
|
B |
108902 |
| 100723 |
|
B |
108903 |
| 100724 |
|
B |
108904 |
| 100725 |
|
B |
108905 |
| 100726 |
|
B |
108906 |
| 100727 |
|
B |
108907 |