Query time 0.00112
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "55.46"
},
"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": 48,
"rows_produced_per_join": 48,
"filtered": "100.00",
"index_condition": "((`nuie_scalesta_net`.`cscart_discussion`.`object_id` in (92169,92170,92390,92391,92392,92393,92394,91550,91619,91788,91789,91790,91791,91792,91793,91794,91795,92501,92502,92503,92504,92505,92506,92507,86858,92192,92193,92194,92195,92196,92204,92205,92206,92207,92208,92209,92442,92443,92448,92147,92148,92149,92349,92350,92351,92352,86864,85644)) and (`nuie_scalesta_net`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "28.81",
"eval_cost": "4.80",
"prefix_cost": "33.61",
"data_read_per_join": "1K"
},
"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": 48,
"filtered": "100.00",
"cost_info": {
"read_cost": "12.00",
"eval_cost": "4.80",
"prefix_cost": "50.41",
"data_read_per_join": "21K"
},
"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": 48,
"filtered": "100.00",
"using_join_buffer": "hash join",
"cost_info": {
"read_cost": "0.25",
"eval_cost": "4.80",
"prefix_cost": "55.46",
"data_read_per_join": "768"
},
"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 |
| 85644 |
|
D |
93682 |
| 86858 |
|
D |
94896 |
| 86864 |
|
D |
94902 |
| 91550 |
|
D |
99623 |
| 91619 |
|
D |
99692 |
| 91788 |
|
D |
99866 |
| 91789 |
|
D |
99867 |
| 91790 |
|
D |
99868 |
| 91791 |
|
D |
99869 |
| 91792 |
|
D |
99870 |
| 91793 |
|
D |
99871 |
| 91794 |
|
D |
99872 |
| 91795 |
|
D |
99873 |
| 92147 |
|
D |
100225 |
| 92148 |
|
D |
100226 |
| 92149 |
|
D |
100227 |
| 92169 |
|
D |
100247 |
| 92170 |
|
D |
100248 |
| 92192 |
|
D |
100270 |
| 92193 |
|
D |
100271 |
| 92194 |
|
D |
100272 |
| 92195 |
|
D |
100273 |
| 92196 |
|
D |
100274 |
| 92204 |
|
D |
100282 |
| 92205 |
|
D |
100283 |
| 92206 |
|
D |
100284 |
| 92207 |
|
D |
100285 |
| 92208 |
|
D |
100286 |
| 92209 |
|
D |
100287 |
| 92349 |
|
D |
100453 |
| 92350 |
|
D |
100454 |
| 92351 |
|
D |
100455 |
| 92352 |
|
D |
100456 |
| 92390 |
|
D |
100494 |
| 92391 |
|
D |
100495 |
| 92392 |
|
D |
100496 |
| 92393 |
|
D |
100497 |
| 92394 |
|
D |
100498 |
| 92442 |
|
D |
100546 |
| 92443 |
|
D |
100547 |
| 92448 |
|
D |
100552 |
| 92501 |
|
D |
100605 |
| 92502 |
|
D |
100606 |
| 92503 |
|
D |
100607 |
| 92504 |
|
D |
100608 |
| 92505 |
|
D |
100609 |
| 92506 |
|
D |
100610 |
| 92507 |
|
D |
100611 |