Query time 0.00088
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 (101383,101384,101385,101386,101387,101388,101389,101390,101391,101392,101393,101394,101395,101396,101397,101398,101399,101400,101401,101402,101403,101404,101405,101406,101407,101408,101409,101410,101411,101412)) 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 |
| 101383 |
|
B |
109566 |
| 101384 |
|
B |
109567 |
| 101385 |
|
B |
109568 |
| 101386 |
|
B |
109569 |
| 101387 |
|
B |
109570 |
| 101388 |
|
B |
109571 |
| 101389 |
|
B |
109572 |
| 101390 |
|
B |
109573 |
| 101391 |
|
B |
109574 |
| 101392 |
|
B |
109575 |
| 101393 |
|
B |
109576 |
| 101394 |
|
B |
109577 |
| 101395 |
|
B |
109578 |
| 101396 |
|
B |
109579 |
| 101397 |
|
B |
109580 |
| 101398 |
|
B |
109581 |
| 101399 |
|
B |
109582 |
| 101400 |
|
B |
109583 |
| 101401 |
|
B |
109584 |
| 101402 |
|
B |
109585 |
| 101403 |
|
B |
109586 |
| 101404 |
|
B |
109587 |
| 101405 |
|
B |
109588 |
| 101406 |
|
B |
109589 |
| 101407 |
|
B |
109590 |
| 101408 |
|
B |
109591 |
| 101409 |
|
B |
109592 |
| 101410 |
|
B |
109593 |
| 101411 |
|
B |
109594 |
| 101412 |
|
B |
109595 |