Query time 0.00137
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "55.46"
},
"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": 48,
"rows_produced_per_join": 48,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (85571,85573,85574,91877,91878,91879,91880,91881,91882,91883,85555,85594,85564,90025,85575,86889,86895,82359,87888,91844,92185,92382,85561,91856,82370,86893,85553,85559,92172,92358,92359,92360,92361,92362,92363,92364,85560,85566,85641,89988,91848,91888,85569,91876,85545,92357,84237,85548)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "28.81",
"eval_cost": "4.80",
"prefix_cost": "33.61",
"data_read_per_join": "1K"
},
"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": 48,
"filtered": "100.00",
"cost_info": {
"read_cost": "12.00",
"eval_cost": "4.80",
"prefix_cost": "50.41",
"data_read_per_join": "21K"
},
"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": 48,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "4.80",
"prefix_cost": "55.46",
"data_read_per_join": "768"
},
"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 |
| 82359 |
|
D |
90397 |
| 82370 |
|
D |
90408 |
| 84237 |
|
D |
92275 |
| 85545 |
|
D |
93583 |
| 85548 |
|
D |
93586 |
| 85553 |
|
D |
93591 |
| 85555 |
|
D |
93593 |
| 85559 |
|
D |
93597 |
| 85560 |
|
D |
93598 |
| 85561 |
|
D |
93599 |
| 85564 |
|
D |
93602 |
| 85566 |
|
D |
93604 |
| 85569 |
|
D |
93607 |
| 85571 |
|
D |
93609 |
| 85573 |
|
D |
93611 |
| 85574 |
|
D |
93612 |
| 85575 |
|
D |
93613 |
| 85594 |
|
D |
93632 |
| 85641 |
|
D |
93679 |
| 86889 |
|
D |
94927 |
| 86893 |
|
D |
94931 |
| 86895 |
|
D |
94933 |
| 87888 |
|
D |
95926 |
| 89988 |
|
D |
98026 |
| 90025 |
|
D |
98063 |
| 91844 |
|
D |
99922 |
| 91848 |
|
D |
99926 |
| 91856 |
|
D |
99934 |
| 91876 |
|
D |
99954 |
| 91877 |
|
D |
99955 |
| 91878 |
|
D |
99956 |
| 91879 |
|
D |
99957 |
| 91880 |
|
D |
99958 |
| 91881 |
|
D |
99959 |
| 91882 |
|
D |
99960 |
| 91883 |
|
D |
99961 |
| 91888 |
|
D |
99966 |
| 92172 |
|
D |
100250 |
| 92185 |
|
D |
100263 |
| 92357 |
|
D |
100461 |
| 92358 |
|
D |
100462 |
| 92359 |
|
D |
100463 |
| 92360 |
|
D |
100464 |
| 92361 |
|
D |
100465 |
| 92362 |
|
D |
100466 |
| 92363 |
|
D |
100467 |
| 92364 |
|
D |
100468 |
| 92382 |
|
D |
100486 |