Query time 0.00103
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 (95171,95172,95173,95174,95175,95176,95177,95178,95179,95180,95181,95182,95183,95184,95185,95186,95187,95188,95189,95190,95191,95192,95193,95194,95195,95196,95197,95198,95199,95200,95201,95202,95203,95204,95205,95206,95207,95208,95209,95210,95211,95212,95213,95214,95215,95216,95217,95218)) 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 |
| 95171 |
|
B |
103343 |
| 95172 |
|
B |
103344 |
| 95173 |
|
B |
103345 |
| 95174 |
|
B |
103346 |
| 95175 |
|
B |
103347 |
| 95176 |
|
B |
103348 |
| 95177 |
|
B |
103349 |
| 95178 |
|
B |
103350 |
| 95179 |
|
B |
103351 |
| 95180 |
|
B |
103352 |
| 95181 |
|
B |
103353 |
| 95182 |
|
B |
103354 |
| 95183 |
|
B |
103355 |
| 95184 |
|
B |
103356 |
| 95185 |
|
B |
103357 |
| 95186 |
|
B |
103358 |
| 95187 |
|
B |
103359 |
| 95188 |
|
B |
103360 |
| 95189 |
|
B |
103361 |
| 95190 |
|
B |
103362 |
| 95191 |
|
B |
103363 |
| 95192 |
|
B |
103364 |
| 95193 |
|
B |
103365 |
| 95194 |
|
B |
103366 |
| 95195 |
|
B |
103367 |
| 95196 |
|
B |
103368 |
| 95197 |
|
B |
103369 |
| 95198 |
|
B |
103370 |
| 95199 |
|
B |
103371 |
| 95200 |
|
B |
103372 |
| 95201 |
|
B |
103373 |
| 95202 |
|
B |
103374 |
| 95203 |
|
B |
103375 |
| 95204 |
|
B |
103376 |
| 95205 |
|
B |
103377 |
| 95206 |
|
B |
103378 |
| 95207 |
|
B |
103379 |
| 95208 |
|
B |
103380 |
| 95209 |
|
B |
103381 |
| 95210 |
|
B |
103382 |
| 95211 |
|
B |
103383 |
| 95212 |
|
B |
103384 |
| 95213 |
|
B |
103385 |
| 95214 |
|
B |
103386 |
| 95215 |
|
B |
103387 |
| 95216 |
|
B |
103388 |
| 95217 |
|
B |
103389 |
| 95218 |
|
B |
103390 |