Query time 0.00087
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 (91414,91416,91418,85102,85104,91009,91021,91033,91046,89062,89495,89496,89503,89504,89511,89512,89519,89520,82833,82835,82906,82908,82979,82981,83393,83395,83403,83405,84533,84534,84599,84600,84306,84307,89807,89809,89859,89861,89931,89933,91497,91499,85295,85297,85392,85394,85443,85445)) 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 |
| 82833 |
|
D |
90871 |
| 82835 |
|
D |
90873 |
| 82906 |
|
D |
90944 |
| 82908 |
|
D |
90946 |
| 82979 |
|
D |
91017 |
| 82981 |
|
D |
91019 |
| 83393 |
|
D |
91431 |
| 83395 |
|
D |
91433 |
| 83403 |
|
D |
91441 |
| 83405 |
|
D |
91443 |
| 84306 |
|
D |
92344 |
| 84307 |
|
D |
92345 |
| 84533 |
|
D |
92571 |
| 84534 |
|
D |
92572 |
| 84599 |
|
D |
92637 |
| 84600 |
|
D |
92638 |
| 85102 |
|
D |
93140 |
| 85104 |
|
D |
93142 |
| 85295 |
|
D |
93333 |
| 85297 |
|
D |
93335 |
| 85392 |
|
D |
93430 |
| 85394 |
|
D |
93432 |
| 85443 |
|
D |
93481 |
| 85445 |
|
D |
93483 |
| 89062 |
|
D |
97100 |
| 89495 |
|
D |
97533 |
| 89496 |
|
D |
97534 |
| 89503 |
|
D |
97541 |
| 89504 |
|
D |
97542 |
| 89511 |
|
D |
97549 |
| 89512 |
|
D |
97550 |
| 89519 |
|
D |
97557 |
| 89520 |
|
D |
97558 |
| 89807 |
|
D |
97845 |
| 89809 |
|
D |
97847 |
| 89859 |
|
D |
97897 |
| 89861 |
|
D |
97899 |
| 89931 |
|
D |
97969 |
| 89933 |
|
D |
97971 |
| 91009 |
|
D |
99082 |
| 91021 |
|
D |
99094 |
| 91033 |
|
D |
99106 |
| 91046 |
|
D |
99119 |
| 91414 |
|
D |
99487 |
| 91416 |
|
D |
99489 |
| 91418 |
|
D |
99491 |
| 91497 |
|
D |
99570 |
| 91499 |
|
D |
99572 |