Query time 0.00081
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 (8427,7160,8428,8431,9799,8433,8434,8435,8436,8438,8439,8440,8441,8442,7159,8444,8445,8447,8448,8450,10934,7444,7789,7790) 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 |
| 7159 |
|
B |
7724 |
| 7160 |
|
B |
7725 |
| 7444 |
|
B |
8043 |
| 7789 |
|
B |
8413 |
| 7790 |
|
B |
8414 |
| 8427 |
|
B |
9086 |
| 8428 |
|
B |
9087 |
| 8431 |
|
B |
9090 |
| 8433 |
|
B |
9092 |
| 8434 |
|
B |
9093 |
| 8435 |
|
B |
9094 |
| 8436 |
|
B |
9095 |
| 8438 |
|
B |
9097 |
| 8439 |
|
B |
9098 |
| 8440 |
|
B |
9099 |
| 8441 |
|
B |
9100 |
| 8442 |
|
B |
9101 |
| 8444 |
|
B |
9103 |
| 8445 |
|
B |
9104 |
| 8447 |
|
B |
9106 |
| 8448 |
|
B |
9107 |
| 8450 |
|
B |
9109 |
| 9799 |
|
B |
10497 |
| 10934 |
|
B |
11652 |