Query time 0.00098
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 (87640,87876,88506,88507,88510,87987,90828,87632,88561,87637,90827,87938,87941,87997,88026,87781,87882,87988,88047,88048,88050,88051,88052,88053,88054,87990,87961,87875,87937,87950,87959,88798,90826,87952,88004,87998,88000,87881,88031,87948,88702,88749,87945,87942,87964,88029,88018,88021)) 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 |
| 87632 |
|
D |
95670 |
| 87637 |
|
D |
95675 |
| 87640 |
|
D |
95678 |
| 87781 |
|
D |
95819 |
| 87875 |
|
D |
95913 |
| 87876 |
|
D |
95914 |
| 87881 |
|
D |
95919 |
| 87882 |
|
D |
95920 |
| 87937 |
|
D |
95975 |
| 87938 |
|
D |
95976 |
| 87941 |
|
D |
95979 |
| 87942 |
|
D |
95980 |
| 87945 |
|
D |
95983 |
| 87948 |
|
D |
95986 |
| 87950 |
|
D |
95988 |
| 87952 |
|
D |
95990 |
| 87959 |
|
D |
95997 |
| 87961 |
|
D |
95999 |
| 87964 |
|
D |
96002 |
| 87987 |
|
D |
96025 |
| 87988 |
|
D |
96026 |
| 87990 |
|
D |
96028 |
| 87997 |
|
D |
96035 |
| 87998 |
|
D |
96036 |
| 88000 |
|
D |
96038 |
| 88004 |
|
D |
96042 |
| 88018 |
|
D |
96056 |
| 88021 |
|
D |
96059 |
| 88026 |
|
D |
96064 |
| 88029 |
|
D |
96067 |
| 88031 |
|
D |
96069 |
| 88047 |
|
D |
96085 |
| 88048 |
|
D |
96086 |
| 88050 |
|
D |
96088 |
| 88051 |
|
D |
96089 |
| 88052 |
|
D |
96090 |
| 88053 |
|
D |
96091 |
| 88054 |
|
D |
96092 |
| 88506 |
|
D |
96544 |
| 88507 |
|
D |
96545 |
| 88510 |
|
D |
96548 |
| 88561 |
|
D |
96599 |
| 88702 |
|
D |
96740 |
| 88749 |
|
D |
96787 |
| 88798 |
|
D |
96836 |
| 90826 |
|
D |
98879 |
| 90827 |
|
D |
98880 |
| 90828 |
|
D |
98881 |