Query time 0.00113
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 (82549,92001,91885,91886,91887,92329,92330,92331,92332,92000,92346,91901,91902,91903,92345,92347,92348,82551,92342,91897,91898,91899,92341,92343,92344,88925,88926,88927,91470,91884,91900,90844,82430,82431,82433,91896,90272,86076,86079,86080,90794,90271,90795,86077,86078,93868,93869,93870)) 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 |
| 82430 |
|
D |
90468 |
| 82431 |
|
D |
90469 |
| 82433 |
|
D |
90471 |
| 82549 |
|
D |
90587 |
| 82551 |
|
D |
90589 |
| 86076 |
|
D |
94114 |
| 86077 |
|
D |
94115 |
| 86078 |
|
D |
94116 |
| 86079 |
|
D |
94117 |
| 86080 |
|
D |
94118 |
| 88925 |
|
D |
96963 |
| 88926 |
|
D |
96964 |
| 88927 |
|
D |
96965 |
| 90271 |
|
D |
98309 |
| 90272 |
|
D |
98310 |
| 90794 |
|
D |
98847 |
| 90795 |
|
D |
98848 |
| 90844 |
|
D |
98917 |
| 91470 |
|
D |
99543 |
| 91884 |
|
D |
99962 |
| 91885 |
|
D |
99963 |
| 91886 |
|
D |
99964 |
| 91887 |
|
D |
99965 |
| 91896 |
|
D |
99974 |
| 91897 |
|
D |
99975 |
| 91898 |
|
D |
99976 |
| 91899 |
|
D |
99977 |
| 91900 |
|
D |
99978 |
| 91901 |
|
D |
99979 |
| 91902 |
|
D |
99980 |
| 91903 |
|
D |
99981 |
| 92000 |
|
D |
100078 |
| 92001 |
|
D |
100079 |
| 92329 |
|
D |
100433 |
| 92330 |
|
D |
100434 |
| 92331 |
|
D |
100435 |
| 92332 |
|
D |
100436 |
| 92341 |
|
D |
100445 |
| 92342 |
|
D |
100446 |
| 92343 |
|
D |
100447 |
| 92344 |
|
D |
100448 |
| 92345 |
|
D |
100449 |
| 92346 |
|
D |
100450 |
| 92347 |
|
D |
100451 |
| 92348 |
|
D |
100452 |
| 93868 |
|
B |
102008 |
| 93869 |
|
B |
102009 |
| 93870 |
|
B |
102010 |