Query time 0.00112
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 (94177,94178,94179,94180,94181,94182,94183,94184,94185,94186,94187,94188,94189,94190,94191,94192,94193,94194,94195,94196,94197,94198,94199,94200,94201,94202,94203,94204,94205,94206,94207,94208,94209,94210,94211,94212,94213,94214,94215,94216,94217,94218,94219,94220,94221,94222,94223,94224)) 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 |
| 94177 |
|
B |
102319 |
| 94178 |
|
B |
102320 |
| 94179 |
|
B |
102321 |
| 94180 |
|
B |
102322 |
| 94181 |
|
B |
102323 |
| 94182 |
|
B |
102324 |
| 94183 |
|
B |
102325 |
| 94184 |
|
B |
102326 |
| 94185 |
|
B |
102327 |
| 94186 |
|
B |
102328 |
| 94187 |
|
B |
102329 |
| 94188 |
|
B |
102330 |
| 94189 |
|
B |
102331 |
| 94190 |
|
B |
102332 |
| 94191 |
|
B |
102333 |
| 94192 |
|
B |
102334 |
| 94193 |
|
B |
102335 |
| 94194 |
|
B |
102336 |
| 94195 |
|
B |
102337 |
| 94196 |
|
B |
102338 |
| 94197 |
|
B |
102339 |
| 94198 |
|
B |
102340 |
| 94199 |
|
B |
102341 |
| 94200 |
|
B |
102342 |
| 94201 |
|
B |
102343 |
| 94202 |
|
B |
102344 |
| 94203 |
|
B |
102345 |
| 94204 |
|
B |
102346 |
| 94205 |
|
B |
102347 |
| 94206 |
|
B |
102348 |
| 94207 |
|
B |
102349 |
| 94208 |
|
B |
102350 |
| 94209 |
|
B |
102351 |
| 94210 |
|
B |
102352 |
| 94211 |
|
B |
102353 |
| 94212 |
|
B |
102354 |
| 94213 |
|
B |
102355 |
| 94214 |
|
B |
102356 |
| 94215 |
|
B |
102357 |
| 94216 |
|
B |
102358 |
| 94217 |
|
B |
102359 |
| 94218 |
|
B |
102360 |
| 94219 |
|
B |
102361 |
| 94220 |
|
B |
102362 |
| 94221 |
|
B |
102363 |
| 94222 |
|
B |
102364 |
| 94223 |
|
B |
102365 |
| 94224 |
|
B |
102366 |