Query time 0.00084
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 (7580,8152,8156,7655,7633,7622,8075,10686,8171,8292,10739,10741,8747,10624,8161,10694,7653,8176,8178,8383,8207,11086,11114,8127) 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 |
| 7580 |
|
B |
8189 |
| 7622 |
|
B |
8235 |
| 7633 |
|
B |
8251 |
| 7653 |
|
B |
8272 |
| 7655 |
|
B |
8275 |
| 8075 |
|
B |
8722 |
| 8127 |
|
B |
8774 |
| 8152 |
|
B |
8799 |
| 8156 |
|
B |
8803 |
| 8161 |
|
B |
8808 |
| 8171 |
|
B |
8818 |
| 8176 |
|
B |
8823 |
| 8178 |
|
B |
8825 |
| 8207 |
|
B |
8856 |
| 8292 |
|
B |
8945 |
| 8383 |
|
B |
9040 |
| 8747 |
|
B |
9419 |
| 10624 |
|
B |
11340 |
| 10686 |
|
B |
11402 |
| 10694 |
|
B |
11410 |
| 10739 |
|
B |
11455 |
| 10741 |
|
B |
11457 |
| 11086 |
|
B |
11805 |
| 11114 |
|
B |
11833 |