Query time 0.00103
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 (97868,97869,97870,97871,97872,97873,97874,97875,97876,97877,97878,97879,97880,97881,97882,97883,97884,97885,97886,97887,97888,97889,97890,97891,97892,97893,97894,97895,97896,97897,97898,97899,97900,97901,97902,97903,97904,97905,97906,97907,97908,97909,97910,97911,97912,97913,97914,97915)) 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 |
| 97868 |
|
B |
106049 |
| 97869 |
|
B |
106050 |
| 97870 |
|
B |
106051 |
| 97871 |
|
B |
106052 |
| 97872 |
|
B |
106053 |
| 97873 |
|
B |
106054 |
| 97874 |
|
B |
106055 |
| 97875 |
|
B |
106056 |
| 97876 |
|
B |
106057 |
| 97877 |
|
B |
106058 |
| 97878 |
|
B |
106059 |
| 97879 |
|
B |
106060 |
| 97880 |
|
B |
106061 |
| 97881 |
|
B |
106062 |
| 97882 |
|
B |
106063 |
| 97883 |
|
B |
106064 |
| 97884 |
|
B |
106065 |
| 97885 |
|
B |
106066 |
| 97886 |
|
B |
106067 |
| 97887 |
|
B |
106068 |
| 97888 |
|
B |
106069 |
| 97889 |
|
B |
106070 |
| 97890 |
|
B |
106071 |
| 97891 |
|
B |
106072 |
| 97892 |
|
B |
106073 |
| 97893 |
|
B |
106074 |
| 97894 |
|
B |
106075 |
| 97895 |
|
B |
106076 |
| 97896 |
|
B |
106077 |
| 97897 |
|
B |
106078 |
| 97898 |
|
B |
106079 |
| 97899 |
|
B |
106080 |
| 97900 |
|
B |
106081 |
| 97901 |
|
B |
106082 |
| 97902 |
|
B |
106083 |
| 97903 |
|
B |
106084 |
| 97904 |
|
B |
106085 |
| 97905 |
|
B |
106086 |
| 97906 |
|
B |
106087 |
| 97907 |
|
B |
106088 |
| 97908 |
|
B |
106089 |
| 97909 |
|
B |
106090 |
| 97910 |
|
B |
106091 |
| 97911 |
|
B |
106092 |
| 97912 |
|
B |
106093 |
| 97913 |
|
B |
106094 |
| 97914 |
|
B |
106095 |
| 97915 |
|
B |
106096 |