Query time 0.00096
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 (96326,96327,96328,96329,96330,96331,96332,96333,96334,96335,96336,96337,96338,96339,96340,96341,96342,96343,96344,96345,96346,96347,96348,96601,96602,96603,96604,96605,96606,96607,96608,96609,96610,96611,96612,96613,96614,96615,96616,96617,96618,96619,96620,96621,96622,96623,96624,96625)) 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 |
| 96326 |
|
B |
104498 |
| 96327 |
|
B |
104499 |
| 96328 |
|
B |
104500 |
| 96329 |
|
B |
104501 |
| 96330 |
|
B |
104502 |
| 96331 |
|
B |
104503 |
| 96332 |
|
B |
104504 |
| 96333 |
|
B |
104505 |
| 96334 |
|
B |
104506 |
| 96335 |
|
B |
104507 |
| 96336 |
|
B |
104508 |
| 96337 |
|
B |
104509 |
| 96338 |
|
B |
104510 |
| 96339 |
|
B |
104511 |
| 96340 |
|
B |
104512 |
| 96341 |
|
B |
104513 |
| 96342 |
|
B |
104514 |
| 96343 |
|
B |
104515 |
| 96344 |
|
B |
104516 |
| 96345 |
|
B |
104517 |
| 96346 |
|
B |
104518 |
| 96347 |
|
B |
104519 |
| 96348 |
|
B |
104520 |
| 96601 |
|
B |
104782 |
| 96602 |
|
B |
104783 |
| 96603 |
|
B |
104784 |
| 96604 |
|
B |
104785 |
| 96605 |
|
B |
104786 |
| 96606 |
|
B |
104787 |
| 96607 |
|
B |
104788 |
| 96608 |
|
B |
104789 |
| 96609 |
|
B |
104790 |
| 96610 |
|
B |
104791 |
| 96611 |
|
B |
104792 |
| 96612 |
|
B |
104793 |
| 96613 |
|
B |
104794 |
| 96614 |
|
B |
104795 |
| 96615 |
|
B |
104796 |
| 96616 |
|
B |
104797 |
| 96617 |
|
B |
104798 |
| 96618 |
|
B |
104799 |
| 96619 |
|
B |
104800 |
| 96620 |
|
B |
104801 |
| 96621 |
|
B |
104802 |
| 96622 |
|
B |
104803 |
| 96623 |
|
B |
104804 |
| 96624 |
|
B |
104805 |
| 96625 |
|
B |
104806 |