Query time 0.00094
JSON explain
{
"query_block": {
"select_id": 1,
"cost_info": {
"query_cost": "46.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": 33,
"rows_produced_per_join": 33,
"filtered": "100.00",
"index_condition": "((`dev_yourmart_co_bw`.`cscart_discussion`.`object_id` in (10983,10820,10902,10901,10844,10853,10858,10842,10861,10968,10969,10845,10856,10857,10850,10849,10839,10852,10854,10841,10859,10838,10843,10848,10860,10903,10904,10905,10847,10821,10982,10980,17001)) and (`dev_yourmart_co_bw`.`cscart_discussion`.`object_type` = 'P'))",
"cost_info": {
"read_cost": "19.81",
"eval_cost": "3.30",
"prefix_cost": "23.11",
"data_read_per_join": "792"
},
"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": 33,
"filtered": "100.00",
"cost_info": {
"read_cost": "8.25",
"eval_cost": "3.30",
"prefix_cost": "34.66",
"data_read_per_join": "14K"
},
"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": 33,
"filtered": "100.00",
"cost_info": {
"read_cost": "8.25",
"eval_cost": "3.30",
"prefix_cost": "46.21",
"data_read_per_join": "528"
},
"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 |
10820 |
|
B |
11809 |
10821 |
|
B |
11810 |
10838 |
|
B |
11827 |
10839 |
|
B |
11828 |
10841 |
|
B |
11830 |
10842 |
|
B |
11831 |
10843 |
|
B |
11832 |
10844 |
|
B |
11833 |
10845 |
|
B |
11834 |
10847 |
|
B |
11836 |
10848 |
|
B |
11837 |
10849 |
|
B |
11838 |
10850 |
|
B |
11839 |
10852 |
|
B |
11841 |
10853 |
|
B |
11842 |
10854 |
|
B |
11843 |
10856 |
|
B |
11845 |
10857 |
|
B |
11846 |
10858 |
|
B |
11847 |
10859 |
|
B |
11848 |
10860 |
|
B |
11849 |
10861 |
|
B |
11850 |
10901 |
|
B |
11890 |
10902 |
|
B |
11891 |
10903 |
|
B |
11892 |
10904 |
|
B |
11893 |
10905 |
|
B |
11894 |
10968 |
|
B |
11957 |
10969 |
|
B |
11958 |
10980 |
|
B |
11969 |
10982 |
|
B |
11971 |
10983 |
|
B |
11972 |
17001 |
|
B |
17778 |