Query time 0.00098
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 (93281,93282,93283,93284,93285,93286,93287,93288,93289,93290,93291,93294,93338,93339,93359,93360,93361,93523,93524,93525,93526,93527,93528,93781,93782,93783,93784,93785,93786,94026)) 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 |
| 93281 |
|
B |
101421 |
| 93282 |
|
B |
101422 |
| 93283 |
|
B |
101423 |
| 93284 |
|
B |
101424 |
| 93285 |
|
B |
101425 |
| 93286 |
|
B |
101426 |
| 93287 |
|
B |
101427 |
| 93288 |
|
B |
101428 |
| 93289 |
|
B |
101429 |
| 93290 |
|
B |
101430 |
| 93291 |
|
B |
101431 |
| 93294 |
|
B |
101434 |
| 93338 |
|
B |
101478 |
| 93339 |
|
B |
101479 |
| 93359 |
|
B |
101499 |
| 93360 |
|
B |
101500 |
| 93361 |
|
B |
101501 |
| 93523 |
|
B |
101663 |
| 93524 |
|
B |
101664 |
| 93525 |
|
B |
101665 |
| 93526 |
|
B |
101666 |
| 93527 |
|
B |
101667 |
| 93528 |
|
B |
101668 |
| 93781 |
|
B |
101921 |
| 93782 |
|
B |
101922 |
| 93783 |
|
B |
101923 |
| 93784 |
|
B |
101924 |
| 93785 |
|
B |
101925 |
| 93786 |
|
B |
101926 |
| 94026 |
|
B |
102166 |