Query time 0.00089
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "34.76"
},
"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": 30,
"rows_produced_per_join": 30,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (94745,94746,94749,96304,96308,96310,96311,96313,96314,96316,96318,96319,96321,96323,96325,96327,96329,96331,96333,96337,97015,97017,97024,97027,97028,97029,97031,97033,97040,97046)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "18.01",
"eval_cost": "3.00",
"prefix_cost": "21.01",
"data_read_per_join": "720"
},
"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": 30,
"filtered": "100.00",
"cost_info": {
"read_cost": "7.50",
"eval_cost": "3.00",
"prefix_cost": "31.51",
"data_read_per_join": "13K"
},
"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": 30,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "3.00",
"prefix_cost": "34.76",
"data_read_per_join": "480"
},
"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 |
| 94745 |
|
B |
102917 |
| 94746 |
|
B |
102918 |
| 94749 |
|
B |
102921 |
| 96304 |
|
B |
104476 |
| 96308 |
|
B |
104480 |
| 96310 |
|
B |
104482 |
| 96311 |
|
B |
104483 |
| 96313 |
|
B |
104485 |
| 96314 |
|
B |
104486 |
| 96316 |
|
B |
104488 |
| 96318 |
|
B |
104490 |
| 96319 |
|
B |
104491 |
| 96321 |
|
B |
104493 |
| 96323 |
|
B |
104495 |
| 96325 |
|
B |
104497 |
| 96327 |
|
B |
104499 |
| 96329 |
|
B |
104501 |
| 96331 |
|
B |
104503 |
| 96333 |
|
B |
104505 |
| 96337 |
|
B |
104509 |
| 97015 |
|
B |
105196 |
| 97017 |
|
B |
105198 |
| 97024 |
|
B |
105205 |
| 97027 |
|
B |
105208 |
| 97028 |
|
B |
105209 |
| 97029 |
|
B |
105210 |
| 97031 |
|
B |
105212 |
| 97033 |
|
B |
105214 |
| 97040 |
|
B |
105221 |
| 97046 |
|
B |
105227 |