Query time 0.00091
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 (96976,96977,96978,96979,96980,98516,98891,98894,98895,98896,100248,100249,100250,100254,100255,100256,100257,100258,100259,100328,100329,100330,100335,100336,100438,100439,100440,100441,100442,100443)) 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 |
| 96976 |
|
B |
105157 |
| 96977 |
|
B |
105158 |
| 96978 |
|
B |
105159 |
| 96979 |
|
B |
105160 |
| 96980 |
|
B |
105161 |
| 98516 |
|
B |
106697 |
| 98891 |
|
B |
107072 |
| 98894 |
|
B |
107075 |
| 98895 |
|
B |
107076 |
| 98896 |
|
B |
107077 |
| 100248 |
|
B |
108428 |
| 100249 |
|
B |
108429 |
| 100250 |
|
B |
108430 |
| 100254 |
|
B |
108434 |
| 100255 |
|
B |
108435 |
| 100256 |
|
B |
108436 |
| 100257 |
|
B |
108437 |
| 100258 |
|
B |
108438 |
| 100259 |
|
B |
108439 |
| 100328 |
|
B |
108508 |
| 100329 |
|
B |
108509 |
| 100330 |
|
B |
108510 |
| 100335 |
|
B |
108515 |
| 100336 |
|
B |
108516 |
| 100438 |
|
B |
108618 |
| 100439 |
|
B |
108619 |
| 100440 |
|
B |
108620 |
| 100441 |
|
B |
108621 |
| 100442 |
|
B |
108622 |
| 100443 |
|
B |
108623 |