Query time 0.00123
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 (94405,94406,94407,94408,94409,94410,94411,94412,94413,94414,94415,94416,94417,94418,94420,94421,94422,94425,94854,94855,94856,94857,94861,94862,94863,94864,94865,94866,94869,94872,94873,94874,94875,94876,94877,94878,94879,94880,94881,94882,94883,94884,94885,94886,94887,94888,94889,94890)) 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 |
| 94405 |
|
B |
102550 |
| 94406 |
|
B |
102551 |
| 94407 |
|
B |
102552 |
| 94408 |
|
B |
102553 |
| 94409 |
|
B |
102554 |
| 94410 |
|
B |
102555 |
| 94411 |
|
B |
102556 |
| 94412 |
|
B |
102557 |
| 94413 |
|
B |
102558 |
| 94414 |
|
B |
102559 |
| 94415 |
|
B |
102560 |
| 94416 |
|
B |
102561 |
| 94417 |
|
B |
102562 |
| 94418 |
|
B |
102563 |
| 94420 |
|
B |
102565 |
| 94421 |
|
B |
102566 |
| 94422 |
|
B |
102567 |
| 94425 |
|
B |
102570 |
| 94854 |
|
B |
103026 |
| 94855 |
|
B |
103027 |
| 94856 |
|
B |
103028 |
| 94857 |
|
B |
103029 |
| 94861 |
|
B |
103033 |
| 94862 |
|
B |
103034 |
| 94863 |
|
B |
103035 |
| 94864 |
|
B |
103036 |
| 94865 |
|
B |
103037 |
| 94866 |
|
B |
103038 |
| 94869 |
|
B |
103041 |
| 94872 |
|
B |
103044 |
| 94873 |
|
B |
103045 |
| 94874 |
|
B |
103046 |
| 94875 |
|
B |
103047 |
| 94876 |
|
B |
103048 |
| 94877 |
|
B |
103049 |
| 94878 |
|
B |
103050 |
| 94879 |
|
B |
103051 |
| 94880 |
|
B |
103052 |
| 94881 |
|
B |
103053 |
| 94882 |
|
B |
103054 |
| 94883 |
|
B |
103055 |
| 94884 |
|
B |
103056 |
| 94885 |
|
B |
103057 |
| 94886 |
|
B |
103058 |
| 94887 |
|
B |
103059 |
| 94888 |
|
B |
103060 |
| 94889 |
|
B |
103061 |
| 94890 |
|
B |
103062 |