Query time 0.00096
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 (84899,86486,86487,86762,86763,84314,88875,88876,88877,88878,88902,88903,82798,82871,82944,83253,83260,84798,84799,86601,86602,86670,86671,91068,85071,85157,85203,85249,82619,82620,83422,83423,89762,83029,83227,83232,83586,84668,84669,84878,90865,90944,85093,85179,85225,85271,82580,82581)) 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 |
| 82580 |
|
D |
90618 |
| 82581 |
|
D |
90619 |
| 82619 |
|
D |
90657 |
| 82620 |
|
D |
90658 |
| 82798 |
|
D |
90836 |
| 82871 |
|
D |
90909 |
| 82944 |
|
D |
90982 |
| 83029 |
|
D |
91067 |
| 83227 |
|
D |
91265 |
| 83232 |
|
D |
91270 |
| 83253 |
|
D |
91291 |
| 83260 |
|
D |
91298 |
| 83422 |
|
D |
91460 |
| 83423 |
|
D |
91461 |
| 83586 |
|
D |
91624 |
| 84314 |
|
D |
92352 |
| 84668 |
|
D |
92706 |
| 84669 |
|
D |
92707 |
| 84798 |
|
D |
92836 |
| 84799 |
|
D |
92837 |
| 84878 |
|
D |
92916 |
| 84899 |
|
D |
92937 |
| 85071 |
|
D |
93109 |
| 85093 |
|
D |
93131 |
| 85157 |
|
D |
93195 |
| 85179 |
|
D |
93217 |
| 85203 |
|
D |
93241 |
| 85225 |
|
D |
93263 |
| 85249 |
|
D |
93287 |
| 85271 |
|
D |
93309 |
| 86486 |
|
D |
94524 |
| 86487 |
|
D |
94525 |
| 86601 |
|
D |
94639 |
| 86602 |
|
D |
94640 |
| 86670 |
|
D |
94708 |
| 86671 |
|
D |
94709 |
| 86762 |
|
D |
94800 |
| 86763 |
|
D |
94801 |
| 88875 |
|
D |
96913 |
| 88876 |
|
D |
96914 |
| 88877 |
|
D |
96915 |
| 88878 |
|
D |
96916 |
| 88902 |
|
D |
96940 |
| 88903 |
|
D |
96941 |
| 89762 |
|
D |
97800 |
| 90865 |
|
D |
98938 |
| 90944 |
|
D |
99017 |
| 91068 |
|
D |
99141 |