Query time 0.00324
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "257.02"
},
"grouping_operation": {
"using_filesort": false,
"nested_loop": [
{
"table": {
"table_name": "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": 96,
"rows_produced_per_join": 96,
"filtered": "100.00",
"index_condition": "((`goimagine`.`discussion`.`object_id` in (283106,283123,283129,289266,291486,306655,282371,282946,282977,282989,283048,283058,283139,289286,289289,289300,282362,282379,282895,282912,282922,282959,283047,283086,291454,282370,282934,282944,282951,282964,283003,283005,283019,283031,283071,283075,283135,283137,283154,289293,291446,291500,282353,282366,282369,282916,282937,282950,282962,282978,283028,283045,283073,283078,283104,283110,283127,283153,289261,282372,282906,282945,282970,282986,283059,283112,283147,283155,289215,289284,291448,291481,282896,282919,283027,283092,283102,283133,291461,291496,306662,282355,282374,282902,282967,282995,282996,283036,283130,289269,291447,291489,282367,282894,282981,283008)) and (`goimagine`.`discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "147.47",
"eval_cost": "9.60",
"prefix_cost": "157.07",
"data_read_per_join": "2K"
},
"used_columns": [
"thread_id",
"object_id",
"object_type",
"type"
]
}
},
{
"table": {
"table_name": "discussion_posts",
"access_type": "ref",
"possible_keys": [
"thread_id",
"thread_id_2"
],
"key": "thread_id_2",
"used_key_parts": [
"thread_id",
"status"
],
"key_length": "6",
"ref": [
"goimagine.discussion.thread_id",
"const"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 168,
"filtered": "100.00",
"using_index": true,
"cost_info": {
"read_cost": "24.02",
"eval_cost": "16.87",
"prefix_cost": "197.96",
"data_read_per_join": "73K"
},
"used_columns": [
"post_id",
"thread_id",
"status"
]
}
},
{
"table": {
"table_name": "discussion_rating",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"thread_id"
],
"key": "PRIMARY",
"used_key_parts": [
"post_id"
],
"key_length": "3",
"ref": [
"goimagine.discussion_posts.post_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 168,
"filtered": "100.00",
"cost_info": {
"read_cost": "42.19",
"eval_cost": "16.87",
"prefix_cost": "257.03",
"data_read_per_join": "2K"
},
"used_columns": [
"rating_value",
"post_id",
"thread_id"
],
"attached_condition": "<if>(is_not_null_compl(discussion_rating), ((`goimagine`.`discussion_rating`.`thread_id` = `goimagine`.`discussion`.`thread_id`) and (`goimagine`.`discussion_rating`.`rating_value` <> 0)), true)"
}
}
]
}
}
}
Result
| product_id |
average_rating |
discussion_type |
discussion_thread_id |
| 282353 |
|
D |
3542468 |
| 282355 |
|
D |
3542470 |
| 282362 |
|
D |
3542477 |
| 282366 |
|
D |
3542481 |
| 282367 |
|
D |
3542482 |
| 282369 |
|
D |
3542484 |
| 282370 |
|
D |
3542485 |
| 282371 |
|
D |
3542486 |
| 282372 |
|
D |
3542487 |
| 282374 |
|
D |
3542489 |
| 282379 |
|
D |
3542494 |
| 282894 |
|
D |
3561014 |
| 282895 |
|
D |
3561015 |
| 282896 |
|
D |
3561016 |
| 282902 |
|
D |
3561022 |
| 282906 |
|
D |
3561026 |
| 282912 |
|
D |
3561032 |
| 282916 |
|
D |
3561036 |
| 282919 |
|
D |
3561039 |
| 282922 |
|
D |
3561042 |
| 282934 |
|
D |
3561054 |
| 282937 |
|
D |
3561057 |
| 282944 |
|
D |
3561064 |
| 282945 |
|
D |
3561065 |
| 282946 |
|
D |
3561066 |
| 282950 |
|
D |
3561070 |
| 282951 |
|
D |
3561071 |
| 282959 |
|
D |
3561079 |
| 282962 |
|
D |
3561082 |
| 282964 |
|
D |
3561084 |
| 282967 |
|
D |
3561087 |
| 282970 |
|
D |
3561090 |
| 282977 |
|
D |
3561097 |
| 282978 |
|
D |
3561098 |
| 282981 |
|
D |
3561101 |
| 282986 |
|
D |
3561106 |
| 282989 |
|
D |
3561109 |
| 282995 |
|
D |
3561115 |
| 282996 |
|
D |
3561116 |
| 283003 |
|
D |
3561123 |
| 283005 |
|
D |
3561125 |
| 283008 |
|
D |
3561128 |
| 283019 |
|
D |
3561139 |
| 283027 |
|
D |
3561147 |
| 283028 |
|
D |
3561148 |
| 283031 |
|
D |
3561151 |
| 283036 |
|
D |
3561156 |
| 283045 |
|
D |
3561165 |
| 283047 |
|
D |
3561167 |
| 283048 |
|
D |
3561168 |
| 283058 |
|
D |
3561178 |
| 283059 |
|
D |
3561179 |
| 283071 |
|
D |
3561191 |
| 283073 |
|
D |
3561193 |
| 283075 |
|
D |
3561195 |
| 283078 |
|
D |
3561198 |
| 283086 |
|
D |
3561206 |
| 283092 |
|
D |
3561212 |
| 283102 |
|
D |
3561222 |
| 283104 |
|
D |
3561224 |
| 283106 |
|
D |
3561226 |
| 283110 |
|
D |
3561230 |
| 283112 |
|
D |
3561232 |
| 283123 |
|
D |
3561243 |
| 283127 |
|
D |
3561247 |
| 283129 |
|
D |
3561249 |
| 283130 |
|
D |
3561250 |
| 283133 |
|
D |
3561253 |
| 283135 |
|
D |
3561255 |
| 283137 |
|
D |
3561257 |
| 283139 |
|
D |
3561259 |
| 283147 |
|
D |
3561267 |
| 283153 |
|
D |
3561273 |
| 283154 |
|
D |
3561274 |
| 283155 |
|
D |
3561275 |
| 289215 |
|
D |
3831886 |
| 289261 |
|
D |
3831973 |
| 289266 |
|
D |
3831978 |
| 289269 |
|
D |
3831981 |
| 289284 |
|
D |
3831997 |
| 289286 |
|
D |
3831999 |
| 289289 |
|
D |
3832002 |
| 289293 |
|
D |
3832006 |
| 289300 |
|
D |
3832015 |
| 291446 |
|
D |
3834241 |
| 291447 |
|
D |
3834242 |
| 291448 |
|
D |
3834243 |
| 291454 |
|
D |
3834249 |
| 291461 |
|
D |
3834256 |
| 291481 |
|
D |
3834277 |
| 291486 |
|
D |
3834283 |
| 291489 |
|
D |
3834286 |
| 291496 |
|
D |
3834293 |
| 291500 |
|
D |
3834297 |
| 306655 |
|
D |
4050535 |
| 306662 |
|
D |
4050546 |