Query time 0.00098
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "42.81"
},
"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": 37,
"rows_produced_per_join": 37,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (96926,96927,96928,96929,96930,96934,96935,96936,96937,96938,96939,96940,96941,98906,98907,98908,98909,100303,100304,100305,100306,100307,100308,100450,100451,100452,100453,100454,100455,100456,100457,100464,100465,100467,100468,100470,100471)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "22.21",
"eval_cost": "3.70",
"prefix_cost": "25.91",
"data_read_per_join": "888"
},
"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": 37,
"filtered": "100.00",
"cost_info": {
"read_cost": "9.25",
"eval_cost": "3.70",
"prefix_cost": "38.86",
"data_read_per_join": "16K"
},
"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": 37,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "3.70",
"prefix_cost": "42.81",
"data_read_per_join": "592"
},
"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 |
| 96926 |
|
B |
105107 |
| 96927 |
|
B |
105108 |
| 96928 |
|
B |
105109 |
| 96929 |
|
B |
105110 |
| 96930 |
|
B |
105111 |
| 96934 |
|
B |
105115 |
| 96935 |
|
B |
105116 |
| 96936 |
|
B |
105117 |
| 96937 |
|
B |
105118 |
| 96938 |
|
B |
105119 |
| 96939 |
|
B |
105120 |
| 96940 |
|
B |
105121 |
| 96941 |
|
B |
105122 |
| 98906 |
|
B |
107087 |
| 98907 |
|
B |
107088 |
| 98908 |
|
B |
107089 |
| 98909 |
|
B |
107090 |
| 100303 |
|
B |
108483 |
| 100304 |
|
B |
108484 |
| 100305 |
|
B |
108485 |
| 100306 |
|
B |
108486 |
| 100307 |
|
B |
108487 |
| 100308 |
|
B |
108488 |
| 100450 |
|
B |
108630 |
| 100451 |
|
B |
108631 |
| 100452 |
|
B |
108632 |
| 100453 |
|
B |
108633 |
| 100454 |
|
B |
108634 |
| 100455 |
|
B |
108635 |
| 100456 |
|
B |
108636 |
| 100457 |
|
B |
108637 |
| 100464 |
|
B |
108644 |
| 100465 |
|
B |
108645 |
| 100467 |
|
B |
108647 |
| 100468 |
|
B |
108648 |
| 100470 |
|
B |
108650 |
| 100471 |
|
B |
108651 |