Query time 0.00106
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 (95855,95856,95857,95858,95859,95860,95861,95862,95863,95864,97426,97427,97428,97429,97430,97431,97432,97433,97434,97435,97436,97437,97438,97439,97440,97441,97442,97443,97444,97445)) 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 |
| 95855 |
|
B |
104027 |
| 95856 |
|
B |
104028 |
| 95857 |
|
B |
104029 |
| 95858 |
|
B |
104030 |
| 95859 |
|
B |
104031 |
| 95860 |
|
B |
104032 |
| 95861 |
|
B |
104033 |
| 95862 |
|
B |
104034 |
| 95863 |
|
B |
104035 |
| 95864 |
|
B |
104036 |
| 97426 |
|
B |
105607 |
| 97427 |
|
B |
105608 |
| 97428 |
|
B |
105609 |
| 97429 |
|
B |
105610 |
| 97430 |
|
B |
105611 |
| 97431 |
|
B |
105612 |
| 97432 |
|
B |
105613 |
| 97433 |
|
B |
105614 |
| 97434 |
|
B |
105615 |
| 97435 |
|
B |
105616 |
| 97436 |
|
B |
105617 |
| 97437 |
|
B |
105618 |
| 97438 |
|
B |
105619 |
| 97439 |
|
B |
105620 |
| 97440 |
|
B |
105621 |
| 97441 |
|
B |
105622 |
| 97442 |
|
B |
105623 |
| 97443 |
|
B |
105624 |
| 97444 |
|
B |
105625 |
| 97445 |
|
B |
105626 |