Query time 0.00121
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "27.86"
},
"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": 24,
"rows_produced_per_join": 24,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (101600,101601,101602,101603,101604,101605,101606,101607,101608,101609,101610,101611,101612,101613,101614,101615,101616,101617,101618,101619,101620,101621,101622,101623)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "14.41",
"eval_cost": "2.40",
"prefix_cost": "16.81",
"data_read_per_join": "576"
},
"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_2",
"used_key_parts": [
"thread_id",
"status"
],
"key_length": "6",
"ref": [
"nuie_scalesta_net.cscart_discussion.thread_id",
"const"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 24,
"filtered": "100.00",
"using_index": true,
"cost_info": {
"read_cost": "6.00",
"eval_cost": "2.40",
"prefix_cost": "25.21",
"data_read_per_join": "10K"
},
"used_columns": [
"post_id",
"thread_id",
"status"
]
}
},
{
"table": {
"table_name": "cscart_discussion_rating",
"access_type": "ALL",
"possible_keys": [
"PRIMARY",
"thread_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 24,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "2.40",
"prefix_cost": "27.86",
"data_read_per_join": "384"
},
"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 |
| 101600 |
|
B |
109783 |
| 101601 |
|
B |
109784 |
| 101602 |
|
B |
109785 |
| 101603 |
|
B |
109786 |
| 101604 |
|
B |
109787 |
| 101605 |
|
B |
109788 |
| 101606 |
|
B |
109789 |
| 101607 |
|
B |
109790 |
| 101608 |
|
B |
109791 |
| 101609 |
|
B |
109792 |
| 101610 |
|
B |
109793 |
| 101611 |
|
B |
109794 |
| 101612 |
|
B |
109795 |
| 101613 |
|
B |
109796 |
| 101614 |
|
B |
109797 |
| 101615 |
|
B |
109798 |
| 101616 |
|
B |
109799 |
| 101617 |
|
B |
109800 |
| 101618 |
|
B |
109801 |
| 101619 |
|
B |
109802 |
| 101620 |
|
B |
109803 |
| 101621 |
|
B |
109804 |
| 101622 |
|
B |
109805 |
| 101623 |
|
B |
109806 |