Query time 0.00100
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "42.01"
},
"grouping_operation": {
"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": 30,
"rows_produced_per_join": 30,
"filtered": "100.00",
"index_condition": "((`dev_yourmart_co_bw`.`cscart_discussion`.`object_id` in (15098,13182,16680,16559,14050,14053,14056,14058,14060,14061,16728,16560,888,16556,16558,16557,14664,16611,16613,16612,16614,16553,16439,17204,14477,17138,16615,16622,16616,16554)) and (`dev_yourmart_co_bw`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "18.01",
"eval_cost": "3.00",
"prefix_cost": "21.01",
"data_read_per_join": "720"
},
"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": [
"dev_yourmart_co_bw.cscart_discussion.thread_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 30,
"filtered": "100.00",
"cost_info": {
"read_cost": "7.50",
"eval_cost": "3.00",
"prefix_cost": "31.51",
"data_read_per_join": "13K"
},
"used_columns": [
"post_id",
"thread_id",
"status"
],
"attached_condition": "<if>(is_not_null_compl(cscart_discussion_posts), (`dev_yourmart_co_bw`.`cscart_discussion_posts`.`status` = 'A'), true)"
}
},
{
"table": {
"table_name": "cscart_discussion_rating",
"access_type": "eq_ref",
"possible_keys": [
"PRIMARY",
"thread_id"
],
"key": "PRIMARY",
"used_key_parts": [
"post_id"
],
"key_length": "3",
"ref": [
"dev_yourmart_co_bw.cscart_discussion_posts.post_id"
],
"rows_examined_per_scan": 1,
"rows_produced_per_join": 30,
"filtered": "100.00",
"cost_info": {
"read_cost": "7.50",
"eval_cost": "3.00",
"prefix_cost": "42.01",
"data_read_per_join": "480"
},
"used_columns": [
"rating_value",
"post_id",
"thread_id"
],
"attached_condition": "<if>(is_not_null_compl(cscart_discussion_rating), ((`dev_yourmart_co_bw`.`cscart_discussion_rating`.`thread_id` = `dev_yourmart_co_bw`.`cscart_discussion`.`thread_id`) and (`dev_yourmart_co_bw`.`cscart_discussion_rating`.`rating_value` <> 0)), true)"
}
}
]
}
}
}
Result
product_id |
average_rating |
discussion_type |
discussion_thread_id |
888 |
|
D |
696 |
13182 |
|
B |
14251 |
14050 |
|
B |
14965 |
14053 |
|
B |
14968 |
14056 |
|
B |
14971 |
14058 |
|
B |
14973 |
14060 |
|
B |
14975 |
14061 |
|
B |
14976 |
14477 |
|
B |
15357 |
14664 |
|
B |
15490 |
15098 |
|
B |
15928 |
16439 |
|
B |
17205 |
16553 |
|
B |
17319 |
16554 |
|
B |
17320 |
16556 |
|
B |
17321 |
16557 |
|
B |
17322 |
16558 |
|
B |
17323 |
16559 |
|
B |
17324 |
16560 |
|
B |
17325 |
16611 |
|
B |
17377 |
16612 |
|
B |
17378 |
16613 |
|
B |
17379 |
16614 |
|
B |
17380 |
16615 |
|
B |
17381 |
16616 |
|
B |
17382 |
16622 |
|
B |
17388 |
16680 |
|
B |
17446 |
16728 |
|
B |
17494 |
17138 |
|
B |
17915 |
17204 |
|
B |
17979 |