Query time 0.00081
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 (86800,85124,85125,85363,85364,89075,89076,90546,84522,84523,84588,84589,85360,89817,89869,89941,91507,83082,83610,86143,86166,86500,86659,86728,86776,89069,90921,91000,84337,85315)) 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_2",
"used_key_parts": [
"thread_id",
"status"
],
"key_length": "6",
"ref": [
"nuie_scalesta_net.cscart_discussion.thread_id",
"const"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 30,
"filtered": "100.00",
"using_index": true,
"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"
]
}
},
{
"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 |
| 83082 |
|
D |
91120 |
| 83610 |
|
D |
91648 |
| 84337 |
|
D |
92375 |
| 84522 |
|
D |
92560 |
| 84523 |
|
D |
92561 |
| 84588 |
|
D |
92626 |
| 84589 |
|
D |
92627 |
| 85124 |
|
D |
93162 |
| 85125 |
|
D |
93163 |
| 85315 |
|
D |
93353 |
| 85360 |
|
D |
93398 |
| 85363 |
|
D |
93401 |
| 85364 |
|
D |
93402 |
| 86143 |
|
D |
94181 |
| 86166 |
|
D |
94204 |
| 86500 |
|
D |
94538 |
| 86659 |
|
D |
94697 |
| 86728 |
|
D |
94766 |
| 86776 |
|
D |
94814 |
| 86800 |
|
D |
94838 |
| 89069 |
|
D |
97107 |
| 89075 |
|
D |
97113 |
| 89076 |
|
D |
97114 |
| 89817 |
|
D |
97855 |
| 89869 |
|
D |
97907 |
| 89941 |
|
D |
97979 |
| 90546 |
|
D |
98598 |
| 90921 |
|
D |
98994 |
| 91000 |
|
D |
99073 |
| 91507 |
|
D |
99580 |