Query time 0.00095
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 (87656,87670,87677,87684,87705,87716,87717,87730,87731,90022,90024,90038,90040,90041,87654,87655,87668,87669,87675,87676,87682,87683,87703,87704,87713,87715,87727,87729,88692,88693,88739,88740,90023,90039,90055,87581,87596,87611,88150,88152,88792,87657,87671,87678,87685,87706,87719,87733)) 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 |
| 87581 |
|
D |
95619 |
| 87596 |
|
D |
95634 |
| 87611 |
|
D |
95649 |
| 87654 |
|
D |
95692 |
| 87655 |
|
D |
95693 |
| 87656 |
|
D |
95694 |
| 87657 |
|
D |
95695 |
| 87668 |
|
D |
95706 |
| 87669 |
|
D |
95707 |
| 87670 |
|
D |
95708 |
| 87671 |
|
D |
95709 |
| 87675 |
|
D |
95713 |
| 87676 |
|
D |
95714 |
| 87677 |
|
D |
95715 |
| 87678 |
|
D |
95716 |
| 87682 |
|
D |
95720 |
| 87683 |
|
D |
95721 |
| 87684 |
|
D |
95722 |
| 87685 |
|
D |
95723 |
| 87703 |
|
D |
95741 |
| 87704 |
|
D |
95742 |
| 87705 |
|
D |
95743 |
| 87706 |
|
D |
95744 |
| 87713 |
|
D |
95751 |
| 87715 |
|
D |
95753 |
| 87716 |
|
D |
95754 |
| 87717 |
|
D |
95755 |
| 87719 |
|
D |
95757 |
| 87727 |
|
D |
95765 |
| 87729 |
|
D |
95767 |
| 87730 |
|
D |
95768 |
| 87731 |
|
D |
95769 |
| 87733 |
|
D |
95771 |
| 88150 |
|
D |
96188 |
| 88152 |
|
D |
96190 |
| 88692 |
|
D |
96730 |
| 88693 |
|
D |
96731 |
| 88739 |
|
D |
96777 |
| 88740 |
|
D |
96778 |
| 88792 |
|
D |
96830 |
| 90022 |
|
D |
98060 |
| 90023 |
|
D |
98061 |
| 90024 |
|
D |
98062 |
| 90038 |
|
D |
98076 |
| 90039 |
|
D |
98077 |
| 90040 |
|
D |
98078 |
| 90041 |
|
D |
98079 |
| 90055 |
|
D |
98093 |