Query time 0.00091
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 (94405,94406,94407,94408,94409,94410,94411,94412,94413,94414,94415,94416,94417,94418,94420,94421,94422,94425,94854,94855,94856,94857,94861,94862)) 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",
"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": 24,
"filtered": "100.00",
"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"
],
"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": 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 |
| 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 |