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 (95919,95920,95921,95922,95923,95924,95925,95926,95927,95928,95929,95930,95931,95934,95935,95937,95938,95939,95941,95942,95943,95944,95945,95946,96123,96130,96202,96203,96204,96205,96206,96207,96208,96210,96211,96295,96298,96299,96300,96301,96341,96342,96343,96344,96345,96346,96347,96348)) 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_2",
"used_key_parts": [
"thread_id",
"status"
],
"key_length": "6",
"ref": [
"nuie_scalesta_net.cscart_discussion.thread_id",
"const"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 48,
"filtered": "100.00",
"using_index": true,
"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"
]
}
},
{
"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 |
| 95919 |
|
B |
104091 |
| 95920 |
|
B |
104092 |
| 95921 |
|
B |
104093 |
| 95922 |
|
B |
104094 |
| 95923 |
|
B |
104095 |
| 95924 |
|
B |
104096 |
| 95925 |
|
B |
104097 |
| 95926 |
|
B |
104098 |
| 95927 |
|
B |
104099 |
| 95928 |
|
B |
104100 |
| 95929 |
|
B |
104101 |
| 95930 |
|
B |
104102 |
| 95931 |
|
B |
104103 |
| 95934 |
|
B |
104106 |
| 95935 |
|
B |
104107 |
| 95937 |
|
B |
104109 |
| 95938 |
|
B |
104110 |
| 95939 |
|
B |
104111 |
| 95941 |
|
B |
104113 |
| 95942 |
|
B |
104114 |
| 95943 |
|
B |
104115 |
| 95944 |
|
B |
104116 |
| 95945 |
|
B |
104117 |
| 95946 |
|
B |
104118 |
| 96123 |
|
B |
104295 |
| 96130 |
|
B |
104302 |
| 96202 |
|
B |
104374 |
| 96203 |
|
B |
104375 |
| 96204 |
|
B |
104376 |
| 96205 |
|
B |
104377 |
| 96206 |
|
B |
104378 |
| 96207 |
|
B |
104379 |
| 96208 |
|
B |
104380 |
| 96210 |
|
B |
104382 |
| 96211 |
|
B |
104383 |
| 96295 |
|
B |
104467 |
| 96298 |
|
B |
104470 |
| 96299 |
|
B |
104471 |
| 96300 |
|
B |
104472 |
| 96301 |
|
B |
104473 |
| 96341 |
|
B |
104513 |
| 96342 |
|
B |
104514 |
| 96343 |
|
B |
104515 |
| 96344 |
|
B |
104516 |
| 96345 |
|
B |
104517 |
| 96346 |
|
B |
104518 |
| 96347 |
|
B |
104519 |
| 96348 |
|
B |
104520 |