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 (91956,91957,91958,91959,84290,82404,82342,82367,86236,86222,82338,82337,82406,82412,82426,86224,91978,91981,82563,82567,82571,82333,86225,91977,91979,91980,91982,91983,82556,85583,89595,89596,89597,82335,82336,82401,82409,82419,82405,82411,82425,91992,91936,91970,91973,86234,82374,91985)) 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 |
| 82333 |
|
D |
90370 |
| 82335 |
|
D |
90372 |
| 82336 |
|
D |
90373 |
| 82337 |
|
D |
90374 |
| 82338 |
|
D |
90375 |
| 82342 |
|
D |
90379 |
| 82367 |
|
D |
90405 |
| 82374 |
|
D |
90412 |
| 82401 |
|
D |
90439 |
| 82404 |
|
D |
90442 |
| 82405 |
|
D |
90443 |
| 82406 |
|
D |
90444 |
| 82409 |
|
D |
90447 |
| 82411 |
|
D |
90449 |
| 82412 |
|
D |
90450 |
| 82419 |
|
D |
90457 |
| 82425 |
|
D |
90463 |
| 82426 |
|
D |
90464 |
| 82556 |
|
D |
90594 |
| 82563 |
|
D |
90601 |
| 82567 |
|
D |
90605 |
| 82571 |
|
D |
90609 |
| 84290 |
|
D |
92328 |
| 85583 |
|
D |
93621 |
| 86222 |
|
D |
94260 |
| 86224 |
|
D |
94262 |
| 86225 |
|
D |
94263 |
| 86234 |
|
D |
94272 |
| 86236 |
|
D |
94274 |
| 89595 |
|
D |
97633 |
| 89596 |
|
D |
97634 |
| 89597 |
|
D |
97635 |
| 91936 |
|
D |
100014 |
| 91956 |
|
D |
100034 |
| 91957 |
|
D |
100035 |
| 91958 |
|
D |
100036 |
| 91959 |
|
D |
100037 |
| 91970 |
|
D |
100048 |
| 91973 |
|
D |
100051 |
| 91977 |
|
D |
100055 |
| 91978 |
|
D |
100056 |
| 91979 |
|
D |
100057 |
| 91980 |
|
D |
100058 |
| 91981 |
|
D |
100059 |
| 91982 |
|
D |
100060 |
| 91983 |
|
D |
100061 |
| 91985 |
|
D |
100063 |
| 91992 |
|
D |
100070 |