Query time 0.00118
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 (91372,91374,91371,91373,91370,91381,91383,91369,91368,91339,91344,91379,91382,91384,91351,91353,91367,91338,91343,91377,91380,91349,91352,91354,91336,91341,91378,91347,91333,91350,91337,91342,91348,91335,91340,91332,91361,91363,91391,91393,91362,91364,91392,91394,91359,91389,86828,91331)) 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 |
| 86828 |
|
D |
94866 |
| 91331 |
|
D |
99404 |
| 91332 |
|
D |
99405 |
| 91333 |
|
D |
99406 |
| 91335 |
|
D |
99408 |
| 91336 |
|
D |
99409 |
| 91337 |
|
D |
99410 |
| 91338 |
|
D |
99411 |
| 91339 |
|
D |
99412 |
| 91340 |
|
D |
99413 |
| 91341 |
|
D |
99414 |
| 91342 |
|
D |
99415 |
| 91343 |
|
D |
99416 |
| 91344 |
|
D |
99417 |
| 91347 |
|
D |
99420 |
| 91348 |
|
D |
99421 |
| 91349 |
|
D |
99422 |
| 91350 |
|
D |
99423 |
| 91351 |
|
D |
99424 |
| 91352 |
|
D |
99425 |
| 91353 |
|
D |
99426 |
| 91354 |
|
D |
99427 |
| 91359 |
|
D |
99432 |
| 91361 |
|
D |
99434 |
| 91362 |
|
D |
99435 |
| 91363 |
|
D |
99436 |
| 91364 |
|
D |
99437 |
| 91367 |
|
D |
99440 |
| 91368 |
|
D |
99441 |
| 91369 |
|
D |
99442 |
| 91370 |
|
D |
99443 |
| 91371 |
|
D |
99444 |
| 91372 |
|
D |
99445 |
| 91373 |
|
D |
99446 |
| 91374 |
|
D |
99447 |
| 91377 |
|
D |
99450 |
| 91378 |
|
D |
99451 |
| 91379 |
|
D |
99452 |
| 91380 |
|
D |
99453 |
| 91381 |
|
D |
99454 |
| 91382 |
|
D |
99455 |
| 91383 |
|
D |
99456 |
| 91384 |
|
D |
99457 |
| 91389 |
|
D |
99462 |
| 91391 |
|
D |
99464 |
| 91392 |
|
D |
99465 |
| 91393 |
|
D |
99466 |
| 91394 |
|
D |
99467 |