Query time 0.01035
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": 25,
"filtered": 100,
"index_condition": "cscart_discussion.company_id = 1 and cscart_discussion.object_id in (9551,12820,10896,8305,10313,9789,8328,12819,7680,10017,6903,9492,9786,8332,8352,8358,6902,9837,9792,10452,8121,9788,6901,12826,12825) 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 |
| 6901 |
|
B |
7387 |
| 6902 |
|
B |
7388 |
| 6903 |
|
B |
7389 |
| 7680 |
|
B |
8302 |
| 8121 |
|
B |
8768 |
| 8305 |
|
B |
8959 |
| 8328 |
|
B |
8984 |
| 8332 |
|
B |
8988 |
| 8352 |
|
B |
9009 |
| 8358 |
|
B |
9015 |
| 9492 |
|
B |
10180 |
| 9551 |
|
B |
10244 |
| 9786 |
|
B |
10484 |
| 9788 |
|
B |
10486 |
| 9789 |
|
B |
10487 |
| 9792 |
|
B |
10490 |
| 9837 |
|
B |
10537 |
| 10017 |
|
B |
10719 |
| 10313 |
|
B |
11021 |
| 10452 |
|
B |
11166 |
| 10896 |
|
B |
11614 |
| 12819 |
|
B |
13574 |
| 12820 |
|
B |
13575 |
| 12825 |
|
B |
13581 |
| 12826 |
|
B |
13582 |