Query time 0.00106
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 (93190,93191,93192,93193,93194,93195,93196,93197,93198,93199,93200,93201,93202,93203,93204,93205,93206,93207,93208,93209,93210,93211,93212,93213,93214,93215,93216,93217,93218,93219,93220,93221,93222,93223,93224,93225,93226,93227,93228,93229,93230,93231,93232,93233,93234,93235,93236,93237)) 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_2",
"used_key_parts": [
"thread_id",
"status"
],
"key_length": "6",
"ref": [
"nuie_scalesta_net.cscart_discussion.thread_id",
"const"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 48,
"filtered": "100.00",
"using_index": true,
"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"
]
}
},
{
"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 |
| 93190 |
|
B |
101330 |
| 93191 |
|
B |
101331 |
| 93192 |
|
B |
101332 |
| 93193 |
|
B |
101333 |
| 93194 |
|
B |
101334 |
| 93195 |
|
B |
101335 |
| 93196 |
|
B |
101336 |
| 93197 |
|
B |
101337 |
| 93198 |
|
B |
101338 |
| 93199 |
|
B |
101339 |
| 93200 |
|
B |
101340 |
| 93201 |
|
B |
101341 |
| 93202 |
|
B |
101342 |
| 93203 |
|
B |
101343 |
| 93204 |
|
B |
101344 |
| 93205 |
|
B |
101345 |
| 93206 |
|
B |
101346 |
| 93207 |
|
B |
101347 |
| 93208 |
|
B |
101348 |
| 93209 |
|
B |
101349 |
| 93210 |
|
B |
101350 |
| 93211 |
|
B |
101351 |
| 93212 |
|
B |
101352 |
| 93213 |
|
B |
101353 |
| 93214 |
|
B |
101354 |
| 93215 |
|
B |
101355 |
| 93216 |
|
B |
101356 |
| 93217 |
|
B |
101357 |
| 93218 |
|
B |
101358 |
| 93219 |
|
B |
101359 |
| 93220 |
|
B |
101360 |
| 93221 |
|
B |
101361 |
| 93222 |
|
B |
101362 |
| 93223 |
|
B |
101363 |
| 93224 |
|
B |
101364 |
| 93225 |
|
B |
101365 |
| 93226 |
|
B |
101366 |
| 93227 |
|
B |
101367 |
| 93228 |
|
B |
101368 |
| 93229 |
|
B |
101369 |
| 93230 |
|
B |
101370 |
| 93231 |
|
B |
101371 |
| 93232 |
|
B |
101372 |
| 93233 |
|
B |
101373 |
| 93234 |
|
B |
101374 |
| 93235 |
|
B |
101375 |
| 93236 |
|
B |
101376 |
| 93237 |
|
B |
101377 |