Query time 0.00122
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 (86630,86632,86699,86701,82822,82824,82895,82897,82968,82970,86190,86191,86213,86214,86522,86523,86798,86799,86188,86211,86520,86796,82603,82605,83071,83072,83624,83625,90907,90908,90986,90987,85082,85168,85214,85260,85122,86189,86212,86521,86797,89073,83069,83622,90905,90984,85080,85166)) 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 |
| 82603 |
|
D |
90641 |
| 82605 |
|
D |
90643 |
| 82822 |
|
D |
90860 |
| 82824 |
|
D |
90862 |
| 82895 |
|
D |
90933 |
| 82897 |
|
D |
90935 |
| 82968 |
|
D |
91006 |
| 82970 |
|
D |
91008 |
| 83069 |
|
D |
91107 |
| 83071 |
|
D |
91109 |
| 83072 |
|
D |
91110 |
| 83622 |
|
D |
91660 |
| 83624 |
|
D |
91662 |
| 83625 |
|
D |
91663 |
| 85080 |
|
D |
93118 |
| 85082 |
|
D |
93120 |
| 85122 |
|
D |
93160 |
| 85166 |
|
D |
93204 |
| 85168 |
|
D |
93206 |
| 85214 |
|
D |
93252 |
| 85260 |
|
D |
93298 |
| 86188 |
|
D |
94226 |
| 86189 |
|
D |
94227 |
| 86190 |
|
D |
94228 |
| 86191 |
|
D |
94229 |
| 86211 |
|
D |
94249 |
| 86212 |
|
D |
94250 |
| 86213 |
|
D |
94251 |
| 86214 |
|
D |
94252 |
| 86520 |
|
D |
94558 |
| 86521 |
|
D |
94559 |
| 86522 |
|
D |
94560 |
| 86523 |
|
D |
94561 |
| 86630 |
|
D |
94668 |
| 86632 |
|
D |
94670 |
| 86699 |
|
D |
94737 |
| 86701 |
|
D |
94739 |
| 86796 |
|
D |
94834 |
| 86797 |
|
D |
94835 |
| 86798 |
|
D |
94836 |
| 86799 |
|
D |
94837 |
| 89073 |
|
D |
97111 |
| 90905 |
|
D |
98978 |
| 90907 |
|
D |
98980 |
| 90908 |
|
D |
98981 |
| 90984 |
|
D |
99057 |
| 90986 |
|
D |
99059 |
| 90987 |
|
D |
99060 |