Query time 0.00104
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "48.56"
},
"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": 42,
"rows_produced_per_join": 42,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (88062,87905,87904,88036,87900,87901,88088,88056,88057,88058,88037,88059,88060,87940,88091,88090,88087,88086,94827,94828,94829,94830,94831,95736,99077,99078,99081,99082,99114,99214,99215,99234,99235,99236,99237,99238,99240,99264,99265,99266,99268,99269)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "25.21",
"eval_cost": "4.20",
"prefix_cost": "29.41",
"data_read_per_join": "1008"
},
"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": 42,
"filtered": "100.00",
"cost_info": {
"read_cost": "10.50",
"eval_cost": "4.20",
"prefix_cost": "44.11",
"data_read_per_join": "18K"
},
"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": 42,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "4.20",
"prefix_cost": "48.56",
"data_read_per_join": "672"
},
"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 |
| 87900 |
|
D |
95938 |
| 87901 |
|
D |
95939 |
| 87904 |
|
D |
95942 |
| 87905 |
|
D |
95943 |
| 87940 |
|
D |
95978 |
| 88036 |
|
D |
96074 |
| 88037 |
|
D |
96075 |
| 88056 |
|
D |
96094 |
| 88057 |
|
D |
96095 |
| 88058 |
|
D |
96096 |
| 88059 |
|
D |
96097 |
| 88060 |
|
D |
96098 |
| 88062 |
|
D |
96100 |
| 88086 |
|
D |
96124 |
| 88087 |
|
D |
96125 |
| 88088 |
|
D |
96126 |
| 88090 |
|
D |
96128 |
| 88091 |
|
D |
96129 |
| 94827 |
|
B |
102999 |
| 94828 |
|
B |
103000 |
| 94829 |
|
B |
103001 |
| 94830 |
|
B |
103002 |
| 94831 |
|
B |
103003 |
| 95736 |
|
B |
103908 |
| 99077 |
|
B |
107258 |
| 99078 |
|
B |
107259 |
| 99081 |
|
B |
107262 |
| 99082 |
|
B |
107263 |
| 99114 |
|
B |
107295 |
| 99214 |
|
B |
107395 |
| 99215 |
|
B |
107396 |
| 99234 |
|
B |
107415 |
| 99235 |
|
B |
107416 |
| 99236 |
|
B |
107417 |
| 99237 |
|
B |
107418 |
| 99238 |
|
B |
107419 |
| 99240 |
|
B |
107421 |
| 99264 |
|
B |
107445 |
| 99265 |
|
B |
107446 |
| 99266 |
|
B |
107447 |
| 99268 |
|
B |
107449 |
| 99269 |
|
B |
107450 |