Query time 0.00108
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "67.21"
},
"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": 48,
"rows_produced_per_join": 48,
"filtered": "100.00",
"index_condition": "((`dev_yourmart_co_bw`.`cscart_discussion`.`object_id` in (16150,15902,16716,16813,16812,16849,17017,16845,16932,16888,16889,15798,16861,16862,16943,15835,15836,15839,15834,15837,16881,15844,16929,16938,16937,16152,16153,16947,15912,15913,15797,13030,13029,15832,16801,16798,16800,16946,16827,16826,16871,16858,15845,16345,15910,16941,16940,16939)) and (`dev_yourmart_co_bw`.`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": [
"dev_yourmart_co_bw.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), (`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": 48,
"filtered": "100.00",
"cost_info": {
"read_cost": "12.00",
"eval_cost": "4.80",
"prefix_cost": "67.21",
"data_read_per_join": "768"
},
"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 |
13029 |
|
B |
14094 |
13030 |
|
B |
14097 |
15797 |
|
B |
16560 |
15798 |
|
B |
16561 |
15832 |
|
B |
16595 |
15834 |
|
B |
16597 |
15835 |
|
B |
16598 |
15836 |
|
B |
16599 |
15837 |
|
B |
16600 |
15839 |
|
B |
16602 |
15844 |
|
B |
16607 |
15845 |
|
B |
16608 |
15902 |
|
B |
16665 |
15910 |
|
B |
16673 |
15912 |
|
B |
16675 |
15913 |
|
B |
16676 |
16150 |
|
B |
16914 |
16152 |
|
B |
16916 |
16153 |
|
B |
16917 |
16345 |
|
B |
17111 |
16716 |
|
B |
17482 |
16798 |
|
B |
17573 |
16800 |
|
B |
17575 |
16801 |
|
B |
17576 |
16812 |
|
B |
17587 |
16813 |
|
B |
17588 |
16826 |
|
B |
17601 |
16827 |
|
B |
17602 |
16845 |
|
B |
17621 |
16849 |
|
B |
17625 |
16858 |
|
B |
17634 |
16861 |
|
B |
17637 |
16862 |
|
B |
17638 |
16871 |
|
B |
17647 |
16881 |
|
B |
17657 |
16888 |
|
B |
17664 |
16889 |
|
B |
17665 |
16929 |
|
B |
17705 |
16932 |
|
B |
17708 |
16937 |
|
B |
17713 |
16938 |
|
B |
17714 |
16939 |
|
B |
17715 |
16940 |
|
B |
17716 |
16941 |
|
B |
17717 |
16943 |
|
B |
17719 |
16946 |
|
B |
17722 |
16947 |
|
B |
17723 |
17017 |
|
B |
17794 |