Query time 0.00091
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 (85699,85711,87421,87422,88546,87430,85675,87426,87427,88544,92554,92597,92598,92599,92600,92601,92602,92620,92621,92622,92623,92624,92625,92643,92644,92645,92646,92647,92648,92666)) 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 |
| 85675 |
|
D |
93713 |
| 85699 |
|
D |
93737 |
| 85711 |
|
D |
93749 |
| 87421 |
|
D |
95459 |
| 87422 |
|
D |
95460 |
| 87426 |
|
D |
95464 |
| 87427 |
|
D |
95465 |
| 87430 |
|
D |
95468 |
| 88544 |
|
D |
96582 |
| 88546 |
|
D |
96584 |
| 92554 |
|
B |
100689 |
| 92597 |
|
B |
100737 |
| 92598 |
|
B |
100738 |
| 92599 |
|
B |
100739 |
| 92600 |
|
B |
100740 |
| 92601 |
|
B |
100741 |
| 92602 |
|
B |
100742 |
| 92620 |
|
B |
100760 |
| 92621 |
|
B |
100761 |
| 92622 |
|
B |
100762 |
| 92623 |
|
B |
100763 |
| 92624 |
|
B |
100764 |
| 92625 |
|
B |
100765 |
| 92643 |
|
B |
100783 |
| 92644 |
|
B |
100784 |
| 92645 |
|
B |
100785 |
| 92646 |
|
B |
100786 |
| 92647 |
|
B |
100787 |
| 92648 |
|
B |
100788 |
| 92666 |
|
B |
100806 |