Query time 0.00087
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "22.11"
},
"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": 19,
"rows_produced_per_join": 19,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (92527,92528,92529,92530,84260,90733,90842,87884,87886,96128,96129,96154,96209,96212,100397,100398,100414,100500,100503)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "11.41",
"eval_cost": "1.90",
"prefix_cost": "13.31",
"data_read_per_join": "456"
},
"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": 19,
"filtered": "100.00",
"cost_info": {
"read_cost": "4.75",
"eval_cost": "1.90",
"prefix_cost": "19.96",
"data_read_per_join": "8K"
},
"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": 19,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "1.90",
"prefix_cost": "22.11",
"data_read_per_join": "304"
},
"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 |
| 84260 |
|
D |
92298 |
| 87884 |
|
D |
95922 |
| 87886 |
|
D |
95924 |
| 90733 |
|
D |
98786 |
| 90842 |
|
D |
98896 |
| 92527 |
|
D |
100649 |
| 92528 |
|
D |
100650 |
| 92529 |
|
D |
100651 |
| 92530 |
|
D |
100652 |
| 96128 |
|
B |
104300 |
| 96129 |
|
B |
104301 |
| 96154 |
|
B |
104326 |
| 96209 |
|
B |
104381 |
| 96212 |
|
B |
104384 |
| 100397 |
|
B |
108577 |
| 100398 |
|
B |
108578 |
| 100414 |
|
B |
108594 |
| 100500 |
|
B |
108680 |
| 100503 |
|
B |
108683 |