Query time 0.00045
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "35.91"
},
"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": 31,
"rows_produced_per_join": 31,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (101517,101523,101526,101532,101535,101552,101555,101561,101564,101570,101573,101824,101825,101826,101827,101828,101829,101830,101831,101832,101833,101844,101845,101846,101847,101848,101849,101850,101851,101852,101853)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "18.61",
"eval_cost": "3.10",
"prefix_cost": "21.71",
"data_read_per_join": "744"
},
"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": 31,
"filtered": "100.00",
"cost_info": {
"read_cost": "7.75",
"eval_cost": "3.10",
"prefix_cost": "32.56",
"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": 31,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "3.10",
"prefix_cost": "35.91",
"data_read_per_join": "496"
},
"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 |
| 101517 |
|
B |
109700 |
| 101523 |
|
B |
109706 |
| 101526 |
|
B |
109709 |
| 101532 |
|
B |
109715 |
| 101535 |
|
B |
109718 |
| 101552 |
|
B |
109735 |
| 101555 |
|
B |
109738 |
| 101561 |
|
B |
109744 |
| 101564 |
|
B |
109747 |
| 101570 |
|
B |
109753 |
| 101573 |
|
B |
109756 |
| 101824 |
|
B |
110007 |
| 101825 |
|
B |
110008 |
| 101826 |
|
B |
110009 |
| 101827 |
|
B |
110010 |
| 101828 |
|
B |
110011 |
| 101829 |
|
B |
110012 |
| 101830 |
|
B |
110013 |
| 101831 |
|
B |
110014 |
| 101832 |
|
B |
110015 |
| 101833 |
|
B |
110016 |
| 101844 |
|
B |
110027 |
| 101845 |
|
B |
110028 |
| 101846 |
|
B |
110029 |
| 101847 |
|
B |
110030 |
| 101848 |
|
B |
110031 |
| 101849 |
|
B |
110032 |
| 101850 |
|
B |
110033 |
| 101851 |
|
B |
110034 |
| 101852 |
|
B |
110035 |
| 101853 |
|
B |
110036 |