Query time 0.00105
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "41.66"
},
"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": 36,
"rows_produced_per_join": 36,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (90788,90790,90789,90791,90784,90786,90774,90772,90785,90787,90780,90782,90775,90781,90783,90773,90776,90778,90777,90779,90770,90768,90771,90769,90766,90767,90764,90765,90762,90763,90759,90758,90760,90761,90757,90756)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "21.61",
"eval_cost": "3.60",
"prefix_cost": "25.21",
"data_read_per_join": "864"
},
"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": 36,
"filtered": "100.00",
"cost_info": {
"read_cost": "9.00",
"eval_cost": "3.60",
"prefix_cost": "37.81",
"data_read_per_join": "15K"
},
"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": 36,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "3.60",
"prefix_cost": "41.66",
"data_read_per_join": "576"
},
"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 |
| 90756 |
|
D |
98809 |
| 90757 |
|
D |
98810 |
| 90758 |
|
D |
98811 |
| 90759 |
|
D |
98812 |
| 90760 |
|
D |
98813 |
| 90761 |
|
D |
98814 |
| 90762 |
|
D |
98815 |
| 90763 |
|
D |
98816 |
| 90764 |
|
D |
98817 |
| 90765 |
|
D |
98818 |
| 90766 |
|
D |
98819 |
| 90767 |
|
D |
98820 |
| 90768 |
|
D |
98821 |
| 90769 |
|
D |
98822 |
| 90770 |
|
D |
98823 |
| 90771 |
|
D |
98824 |
| 90772 |
|
D |
98825 |
| 90773 |
|
D |
98826 |
| 90774 |
|
D |
98827 |
| 90775 |
|
D |
98828 |
| 90776 |
|
D |
98829 |
| 90777 |
|
D |
98830 |
| 90778 |
|
D |
98831 |
| 90779 |
|
D |
98832 |
| 90780 |
|
D |
98833 |
| 90781 |
|
D |
98834 |
| 90782 |
|
D |
98835 |
| 90783 |
|
D |
98836 |
| 90784 |
|
D |
98837 |
| 90785 |
|
D |
98838 |
| 90786 |
|
D |
98839 |
| 90787 |
|
D |
98840 |
| 90788 |
|
D |
98841 |
| 90789 |
|
D |
98842 |
| 90790 |
|
D |
98843 |
| 90791 |
|
D |
98844 |