Query time 0.00106
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 (90287,90176,90192,90309,90236,90241,85960,90235,90240,90225,90183,90234,90239,90224,90199,90173,90308,90223,90278,90286,90198,90222,90221,90197,90205,90216,90220,90191,90277,91538,91539,90210,90233,91536,91537,90190,90182,90172,90276,90204,90215,90209,90232,90196,82561,90189,90268,90264)) 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 |
| 82561 |
|
D |
90599 |
| 85960 |
|
D |
93998 |
| 90172 |
|
D |
98210 |
| 90173 |
|
D |
98211 |
| 90176 |
|
D |
98214 |
| 90182 |
|
D |
98220 |
| 90183 |
|
D |
98221 |
| 90189 |
|
D |
98227 |
| 90190 |
|
D |
98228 |
| 90191 |
|
D |
98229 |
| 90192 |
|
D |
98230 |
| 90196 |
|
D |
98234 |
| 90197 |
|
D |
98235 |
| 90198 |
|
D |
98236 |
| 90199 |
|
D |
98237 |
| 90204 |
|
D |
98242 |
| 90205 |
|
D |
98243 |
| 90209 |
|
D |
98247 |
| 90210 |
|
D |
98248 |
| 90215 |
|
D |
98253 |
| 90216 |
|
D |
98254 |
| 90220 |
|
D |
98258 |
| 90221 |
|
D |
98259 |
| 90222 |
|
D |
98260 |
| 90223 |
|
D |
98261 |
| 90224 |
|
D |
98262 |
| 90225 |
|
D |
98263 |
| 90232 |
|
D |
98270 |
| 90233 |
|
D |
98271 |
| 90234 |
|
D |
98272 |
| 90235 |
|
D |
98273 |
| 90236 |
|
D |
98274 |
| 90239 |
|
D |
98277 |
| 90240 |
|
D |
98278 |
| 90241 |
|
D |
98279 |
| 90264 |
|
D |
98302 |
| 90268 |
|
D |
98306 |
| 90276 |
|
D |
98314 |
| 90277 |
|
D |
98315 |
| 90278 |
|
D |
98316 |
| 90286 |
|
D |
98324 |
| 90287 |
|
D |
98325 |
| 90308 |
|
D |
98346 |
| 90309 |
|
D |
98347 |
| 91536 |
|
D |
99609 |
| 91537 |
|
D |
99610 |
| 91538 |
|
D |
99611 |
| 91539 |
|
D |
99612 |