Query time 0.00063
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": 24,
"filtered": 100,
"index_condition": "cscart_discussion.company_id = 1 and cscart_discussion.object_id in (6758,6759,6760,6915,6916,6761,6762,11378,6763,6764,6765,6766,6767,6768,10246,6769,6770,6771,6772,6743,6773,6774,6775,6776) 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 |
| 6743 |
|
B |
7178 |
| 6758 |
|
B |
7193 |
| 6759 |
|
B |
7194 |
| 6760 |
|
B |
7195 |
| 6761 |
|
B |
7196 |
| 6762 |
|
B |
7197 |
| 6763 |
|
B |
7198 |
| 6764 |
|
B |
7199 |
| 6765 |
|
B |
7200 |
| 6766 |
|
B |
7201 |
| 6767 |
|
B |
7202 |
| 6768 |
|
B |
7203 |
| 6769 |
|
B |
7204 |
| 6770 |
|
B |
7205 |
| 6771 |
|
B |
7206 |
| 6772 |
|
B |
7207 |
| 6773 |
|
B |
7208 |
| 6774 |
|
B |
7209 |
| 6775 |
|
B |
7210 |
| 6776 |
|
B |
7211 |
| 6915 |
|
B |
7404 |
| 6916 |
|
B |
7405 |
| 10246 |
|
B |
10952 |
| 11378 |
|
B |
12105 |