Query time 0.00090
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 (7181,8437,8446,7542,8451,7435,8452,8453,8454,9782,9777,9794,9780,9796,9779,9778,9793,9784,9785,9776,10903,9787,9791,10337) 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 |
| 7181 |
|
B |
7750 |
| 7435 |
|
B |
8033 |
| 7542 |
|
B |
8151 |
| 8437 |
|
B |
9096 |
| 8446 |
|
B |
9105 |
| 8451 |
|
B |
9110 |
| 8452 |
|
B |
9111 |
| 8453 |
|
B |
9112 |
| 8454 |
|
B |
9113 |
| 9776 |
|
B |
10474 |
| 9777 |
|
B |
10475 |
| 9778 |
|
B |
10476 |
| 9779 |
|
B |
10477 |
| 9780 |
|
B |
10478 |
| 9782 |
|
B |
10480 |
| 9784 |
|
B |
10482 |
| 9785 |
|
B |
10483 |
| 9787 |
|
B |
10485 |
| 9791 |
|
B |
10489 |
| 9793 |
|
B |
10491 |
| 9794 |
|
B |
10492 |
| 9796 |
|
B |
10494 |
| 10337 |
|
B |
11045 |
| 10903 |
|
B |
11621 |