Query time 0.00115
JSON explain
{
"query_block": {
"select_id": 1,
"nested_loop": [
{
"table": {
"table_name": "cscart_discussion",
"access_type": "range",
"possible_keys": ["object_id", "idx_company_id"],
"key": "object_id",
"key_length": "10",
"used_key_parts": ["object_id", "object_type", "company_id"],
"rows": 16,
"filtered": 100,
"index_condition": "cscart_discussion.company_id = 1 and cscart_discussion.object_id in (18034,8292,10844,10667,8181,11109,8163,18037,8174,12394,13546,7651,8083,8186,11107,11108) and cscart_discussion.object_type = 'P'"
}
},
{
"table": {
"table_name": "cscart_discussion_posts",
"access_type": "ref",
"possible_keys": ["thread_id", "thread_id_2"],
"key": "thread_id_2",
"key_length": "6",
"used_key_parts": ["thread_id", "status"],
"ref": ["lillyshop_lillyshop.cscart_discussion.thread_id", "const"],
"rows": 2,
"filtered": 100,
"attached_condition": "trigcond(cscart_discussion_posts.`status` = 'A')"
}
},
{
"table": {
"table_name": "cscart_discussion_rating",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY", "thread_id"],
"key": "PRIMARY",
"key_length": "3",
"used_key_parts": ["post_id"],
"ref": ["lillyshop_lillyshop.cscart_discussion_posts.post_id"],
"rows": 1,
"filtered": 100,
"attached_condition": "trigcond(cscart_discussion_rating.thread_id = cscart_discussion.thread_id and cscart_discussion_rating.rating_value <> 0 and trigcond(cscart_discussion_posts.post_id is not null))"
}
}
]
}
}
Result
| product_id |
average_rating |
discussion_type |
discussion_thread_id |
| 7651 |
|
B |
8270 |
| 8083 |
|
B |
8730 |
| 8163 |
|
B |
8810 |
| 8174 |
|
B |
8821 |
| 8181 |
|
B |
8828 |
| 8186 |
|
B |
8833 |
| 8292 |
|
B |
8945 |
| 10667 |
|
B |
11383 |
| 10844 |
|
B |
11562 |
| 11107 |
|
B |
11826 |
| 11108 |
|
B |
11827 |
| 11109 |
|
B |
11828 |
| 12394 |
|
B |
13146 |
| 13546 |
|
B |
14320 |
| 18034 |
|
D |
18832 |
| 18037 |
|
D |
18835 |