Query time 0.00084
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 (98346,98347,98348,98349,98350,98383,98384,98385,98386,98387,98388,98389,98390,98417,98419,98423,98430,98431,98444,98448,98454,98550,98560,98561,98562,98570,98686,98716,98718,98720)) 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 |
| 98346 |
|
B |
106527 |
| 98347 |
|
B |
106528 |
| 98348 |
|
B |
106529 |
| 98349 |
|
B |
106530 |
| 98350 |
|
B |
106531 |
| 98383 |
|
B |
106564 |
| 98384 |
|
B |
106565 |
| 98385 |
|
B |
106566 |
| 98386 |
|
B |
106567 |
| 98387 |
|
B |
106568 |
| 98388 |
|
B |
106569 |
| 98389 |
|
B |
106570 |
| 98390 |
|
B |
106571 |
| 98417 |
|
B |
106598 |
| 98419 |
|
B |
106600 |
| 98423 |
|
B |
106604 |
| 98430 |
|
B |
106611 |
| 98431 |
|
B |
106612 |
| 98444 |
|
B |
106625 |
| 98448 |
|
B |
106629 |
| 98454 |
|
B |
106635 |
| 98550 |
|
B |
106731 |
| 98560 |
|
B |
106741 |
| 98561 |
|
B |
106742 |
| 98562 |
|
B |
106743 |
| 98570 |
|
B |
106751 |
| 98686 |
|
B |
106867 |
| 98716 |
|
B |
106897 |
| 98718 |
|
B |
106899 |
| 98720 |
|
B |
106901 |