Query time 0.00123
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "34.76"
},
"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": 30,
"rows_produced_per_join": 30,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (97236,97237,97238,97239,97240,97241,97242,97243,97244,97245,97246,97247,97248,97249,97250,97251,97252,97253,97254,97255,97256,97257,97258,97259,97260,97261,97262,97263,97264,97265)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "18.01",
"eval_cost": "3.00",
"prefix_cost": "21.01",
"data_read_per_join": "720"
},
"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": 30,
"filtered": "100.00",
"cost_info": {
"read_cost": "7.50",
"eval_cost": "3.00",
"prefix_cost": "31.51",
"data_read_per_join": "13K"
},
"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": 30,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "3.00",
"prefix_cost": "34.76",
"data_read_per_join": "480"
},
"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 |
| 97236 |
|
B |
105417 |
| 97237 |
|
B |
105418 |
| 97238 |
|
B |
105419 |
| 97239 |
|
B |
105420 |
| 97240 |
|
B |
105421 |
| 97241 |
|
B |
105422 |
| 97242 |
|
B |
105423 |
| 97243 |
|
B |
105424 |
| 97244 |
|
B |
105425 |
| 97245 |
|
B |
105426 |
| 97246 |
|
B |
105427 |
| 97247 |
|
B |
105428 |
| 97248 |
|
B |
105429 |
| 97249 |
|
B |
105430 |
| 97250 |
|
B |
105431 |
| 97251 |
|
B |
105432 |
| 97252 |
|
B |
105433 |
| 97253 |
|
B |
105434 |
| 97254 |
|
B |
105435 |
| 97255 |
|
B |
105436 |
| 97256 |
|
B |
105437 |
| 97257 |
|
B |
105438 |
| 97258 |
|
B |
105439 |
| 97259 |
|
B |
105440 |
| 97260 |
|
B |
105441 |
| 97261 |
|
B |
105442 |
| 97262 |
|
B |
105443 |
| 97263 |
|
B |
105444 |
| 97264 |
|
B |
105445 |
| 97265 |
|
B |
105446 |