Query time 0.00052
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 (95837,95838,95839,95840,95841,95842,95843,95844,95845,95846,95847,95848,95849,95850,95851,95852,95853,95854,95855,95856,95857,95858,95859,95860,95861,95862,95863,95864,95865,95866,95885,95886,95887,95888,95894,96117,96118,96176,96529,96569,97426,97427,97428,97429,97430,97431,97432,97433)) 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 |
| 95837 |
|
B |
104009 |
| 95838 |
|
B |
104010 |
| 95839 |
|
B |
104011 |
| 95840 |
|
B |
104012 |
| 95841 |
|
B |
104013 |
| 95842 |
|
B |
104014 |
| 95843 |
|
B |
104015 |
| 95844 |
|
B |
104016 |
| 95845 |
|
B |
104017 |
| 95846 |
|
B |
104018 |
| 95847 |
|
B |
104019 |
| 95848 |
|
B |
104020 |
| 95849 |
|
B |
104021 |
| 95850 |
|
B |
104022 |
| 95851 |
|
B |
104023 |
| 95852 |
|
B |
104024 |
| 95853 |
|
B |
104025 |
| 95854 |
|
B |
104026 |
| 95855 |
|
B |
104027 |
| 95856 |
|
B |
104028 |
| 95857 |
|
B |
104029 |
| 95858 |
|
B |
104030 |
| 95859 |
|
B |
104031 |
| 95860 |
|
B |
104032 |
| 95861 |
|
B |
104033 |
| 95862 |
|
B |
104034 |
| 95863 |
|
B |
104035 |
| 95864 |
|
B |
104036 |
| 95865 |
|
B |
104037 |
| 95866 |
|
B |
104038 |
| 95885 |
|
B |
104057 |
| 95886 |
|
B |
104058 |
| 95887 |
|
B |
104059 |
| 95888 |
|
B |
104060 |
| 95894 |
|
B |
104066 |
| 96117 |
|
B |
104289 |
| 96118 |
|
B |
104290 |
| 96176 |
|
B |
104348 |
| 96529 |
|
B |
104710 |
| 96569 |
|
B |
104750 |
| 97426 |
|
B |
105607 |
| 97427 |
|
B |
105608 |
| 97428 |
|
B |
105609 |
| 97429 |
|
B |
105610 |
| 97430 |
|
B |
105611 |
| 97431 |
|
B |
105612 |
| 97432 |
|
B |
105613 |
| 97433 |
|
B |
105614 |