Query time 0.00064
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 (87026,87051,87086,87109,83576,83578,90583,90584,90915,90917,90994,90996,91396,91398,91400,91402,91404,91406,91408,91410,91412,91414,91416,91418,91009,91021,91033,91046,89495,89496,89503,89504,89511,89512,89519,89520,86903,86928,86964,86989,87025,87050,87108,90796,83289,83291,83296,83298)) 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 |
| 83289 |
|
D |
91327 |
| 83291 |
|
D |
91329 |
| 83296 |
|
D |
91334 |
| 83298 |
|
D |
91336 |
| 83576 |
|
D |
91614 |
| 83578 |
|
D |
91616 |
| 86903 |
|
D |
94941 |
| 86928 |
|
D |
94966 |
| 86964 |
|
D |
95002 |
| 86989 |
|
D |
95027 |
| 87025 |
|
D |
95063 |
| 87026 |
|
D |
95064 |
| 87050 |
|
D |
95088 |
| 87051 |
|
D |
95089 |
| 87086 |
|
D |
95124 |
| 87108 |
|
D |
95146 |
| 87109 |
|
D |
95147 |
| 89495 |
|
D |
97533 |
| 89496 |
|
D |
97534 |
| 89503 |
|
D |
97541 |
| 89504 |
|
D |
97542 |
| 89511 |
|
D |
97549 |
| 89512 |
|
D |
97550 |
| 89519 |
|
D |
97557 |
| 89520 |
|
D |
97558 |
| 90583 |
|
D |
98635 |
| 90584 |
|
D |
98636 |
| 90796 |
|
D |
98849 |
| 90915 |
|
D |
98988 |
| 90917 |
|
D |
98990 |
| 90994 |
|
D |
99067 |
| 90996 |
|
D |
99069 |
| 91009 |
|
D |
99082 |
| 91021 |
|
D |
99094 |
| 91033 |
|
D |
99106 |
| 91046 |
|
D |
99119 |
| 91396 |
|
D |
99469 |
| 91398 |
|
D |
99471 |
| 91400 |
|
D |
99473 |
| 91402 |
|
D |
99475 |
| 91404 |
|
D |
99477 |
| 91406 |
|
D |
99479 |
| 91408 |
|
D |
99481 |
| 91410 |
|
D |
99483 |
| 91412 |
|
D |
99485 |
| 91414 |
|
D |
99487 |
| 91416 |
|
D |
99489 |
| 91418 |
|
D |
99491 |