Query time 0.00068
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 (6777,6778,6779,6780,6781,6782,6783,6784,6785,11375,10778,8680,6786,6787,6788,6789,8008,9495,7914,6790,6791,6793,6794,6795) 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 |
| 6777 |
|
B |
7212 |
| 6778 |
|
B |
7213 |
| 6779 |
|
B |
7214 |
| 6780 |
|
B |
7215 |
| 6781 |
|
B |
7216 |
| 6782 |
|
B |
7217 |
| 6783 |
|
B |
7218 |
| 6784 |
|
B |
7219 |
| 6785 |
|
B |
7220 |
| 6786 |
|
B |
7221 |
| 6787 |
|
B |
7222 |
| 6788 |
|
B |
7223 |
| 6789 |
|
B |
7224 |
| 6790 |
|
B |
7225 |
| 6791 |
|
B |
7226 |
| 6793 |
|
B |
7229 |
| 6794 |
|
B |
7230 |
| 6795 |
|
B |
7231 |
| 7914 |
|
B |
8550 |
| 8008 |
|
B |
8652 |
| 8680 |
|
B |
9347 |
| 9495 |
|
B |
10183 |
| 10778 |
|
B |
11495 |
| 11375 |
|
B |
12102 |