Query time 0.00089
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 (96512,96513,96514,96515,96516,96517,96518,96519,96520,96521,96538,96539,96540,96541,96542,96543,96544,96545,96546,96547,96548,96549,96550,96551,96552,96553,96554,96555,96556,96557)) 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 |
| 96512 |
|
B |
104693 |
| 96513 |
|
B |
104694 |
| 96514 |
|
B |
104695 |
| 96515 |
|
B |
104696 |
| 96516 |
|
B |
104697 |
| 96517 |
|
B |
104698 |
| 96518 |
|
B |
104699 |
| 96519 |
|
B |
104700 |
| 96520 |
|
B |
104701 |
| 96521 |
|
B |
104702 |
| 96538 |
|
B |
104719 |
| 96539 |
|
B |
104720 |
| 96540 |
|
B |
104721 |
| 96541 |
|
B |
104722 |
| 96542 |
|
B |
104723 |
| 96543 |
|
B |
104724 |
| 96544 |
|
B |
104725 |
| 96545 |
|
B |
104726 |
| 96546 |
|
B |
104727 |
| 96547 |
|
B |
104728 |
| 96548 |
|
B |
104729 |
| 96549 |
|
B |
104730 |
| 96550 |
|
B |
104731 |
| 96551 |
|
B |
104732 |
| 96552 |
|
B |
104733 |
| 96553 |
|
B |
104734 |
| 96554 |
|
B |
104735 |
| 96555 |
|
B |
104736 |
| 96556 |
|
B |
104737 |
| 96557 |
|
B |
104738 |