Query time 0.00073
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 (6723,6722,6724,6712,6725,6726,6727,6728,6729,6731,6732,8742,6734,6735,6736,6737,6738,6739,6741,6742,6748,8801,8802,11103) 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 |
| 6712 |
|
B |
7147 |
| 6722 |
|
B |
7157 |
| 6723 |
|
B |
7158 |
| 6724 |
|
B |
7159 |
| 6725 |
|
B |
7160 |
| 6726 |
|
B |
7161 |
| 6727 |
|
B |
7162 |
| 6728 |
|
B |
7163 |
| 6729 |
|
B |
7164 |
| 6731 |
|
B |
7166 |
| 6732 |
|
B |
7167 |
| 6734 |
|
B |
7169 |
| 6735 |
|
B |
7170 |
| 6736 |
|
B |
7171 |
| 6737 |
|
B |
7172 |
| 6738 |
|
B |
7173 |
| 6739 |
|
B |
7174 |
| 6741 |
|
B |
7176 |
| 6742 |
|
B |
7177 |
| 6748 |
|
B |
7183 |
| 8742 |
|
B |
9414 |
| 8801 |
|
B |
9478 |
| 8802 |
|
B |
9479 |
| 11103 |
|
B |
11822 |