Query time 0.00084
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "20.96"
},
"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": 18,
"rows_produced_per_join": 18,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (99093,99094,99095,99096,99097,99098,99099,99100,99101,99102,99103,99104,99105,99106,99107,99108,99109,99213)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "10.81",
"eval_cost": "1.80",
"prefix_cost": "12.61",
"data_read_per_join": "432"
},
"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": 18,
"filtered": "100.00",
"cost_info": {
"read_cost": "4.50",
"eval_cost": "1.80",
"prefix_cost": "18.91",
"data_read_per_join": "7K"
},
"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": 18,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "1.80",
"prefix_cost": "20.96",
"data_read_per_join": "288"
},
"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 |
| 99093 |
|
B |
107274 |
| 99094 |
|
B |
107275 |
| 99095 |
|
B |
107276 |
| 99096 |
|
B |
107277 |
| 99097 |
|
B |
107278 |
| 99098 |
|
B |
107279 |
| 99099 |
|
B |
107280 |
| 99100 |
|
B |
107281 |
| 99101 |
|
B |
107282 |
| 99102 |
|
B |
107283 |
| 99103 |
|
B |
107284 |
| 99104 |
|
B |
107285 |
| 99105 |
|
B |
107286 |
| 99106 |
|
B |
107287 |
| 99107 |
|
B |
107288 |
| 99108 |
|
B |
107289 |
| 99109 |
|
B |
107290 |
| 99213 |
|
B |
107394 |