Query time 0.00044
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 (96851,96852,96853,96854,96855,96856,96857,96858,96859,96860,96861,96862,96863,96864,96865,96866,96867,96868,96869,96870,96871,96872,96873,96874,96875,96876,96877,96878,96879,96880)) 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 |
| 96851 |
|
B |
105032 |
| 96852 |
|
B |
105033 |
| 96853 |
|
B |
105034 |
| 96854 |
|
B |
105035 |
| 96855 |
|
B |
105036 |
| 96856 |
|
B |
105037 |
| 96857 |
|
B |
105038 |
| 96858 |
|
B |
105039 |
| 96859 |
|
B |
105040 |
| 96860 |
|
B |
105041 |
| 96861 |
|
B |
105042 |
| 96862 |
|
B |
105043 |
| 96863 |
|
B |
105044 |
| 96864 |
|
B |
105045 |
| 96865 |
|
B |
105046 |
| 96866 |
|
B |
105047 |
| 96867 |
|
B |
105048 |
| 96868 |
|
B |
105049 |
| 96869 |
|
B |
105050 |
| 96870 |
|
B |
105051 |
| 96871 |
|
B |
105052 |
| 96872 |
|
B |
105053 |
| 96873 |
|
B |
105054 |
| 96874 |
|
B |
105055 |
| 96875 |
|
B |
105056 |
| 96876 |
|
B |
105057 |
| 96877 |
|
B |
105058 |
| 96878 |
|
B |
105059 |
| 96879 |
|
B |
105060 |
| 96880 |
|
B |
105061 |