Query time 0.00102
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 (101473,101474,101475,101476,101477,101478,101479,101480,101481,101482,101483,101484,101485,101486,101487,101488,101489,101490,101491,101492,101493,101494,101495,101496,101497,101498,101499,101500,101501,101502)) 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 |
| 101473 |
|
B |
109656 |
| 101474 |
|
B |
109657 |
| 101475 |
|
B |
109658 |
| 101476 |
|
B |
109659 |
| 101477 |
|
B |
109660 |
| 101478 |
|
B |
109661 |
| 101479 |
|
B |
109662 |
| 101480 |
|
B |
109663 |
| 101481 |
|
B |
109664 |
| 101482 |
|
B |
109665 |
| 101483 |
|
B |
109666 |
| 101484 |
|
B |
109667 |
| 101485 |
|
B |
109668 |
| 101486 |
|
B |
109669 |
| 101487 |
|
B |
109670 |
| 101488 |
|
B |
109671 |
| 101489 |
|
B |
109672 |
| 101490 |
|
B |
109673 |
| 101491 |
|
B |
109674 |
| 101492 |
|
B |
109675 |
| 101493 |
|
B |
109676 |
| 101494 |
|
B |
109677 |
| 101495 |
|
B |
109678 |
| 101496 |
|
B |
109679 |
| 101497 |
|
B |
109680 |
| 101498 |
|
B |
109681 |
| 101499 |
|
B |
109682 |
| 101500 |
|
B |
109683 |
| 101501 |
|
B |
109684 |
| 101502 |
|
B |
109685 |