Query time 0.00877
JSON explain
{
"query_block": {
"select_id": 1,
"cost": 0.168529282,
"filesort": {
"sort_key": "p.product_id",
"temporary_table": {
"nested_loop": [
{
"table": {
"table_name": "dp",
"access_type": "ALL",
"possible_keys": ["thread_id", "thread_id_2"],
"loops": 1,
"rows": 50,
"cost": 0.01785585,
"filtered": 100,
"attached_condition": "dp.`status` = 'A'"
}
},
{
"table": {
"table_name": "tmall_discussion",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY", "object_id"],
"key": "PRIMARY",
"key_length": "3",
"used_key_parts": ["thread_id"],
"ref": ["tmall.dp.thread_id"],
"loops": 50,
"rows": 1,
"cost": 0.0866561,
"filtered": 100,
"attached_condition": "tmall_discussion.object_type = 'P'"
}
},
{
"table": {
"table_name": "p",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY"],
"key": "PRIMARY",
"key_length": "3",
"used_key_parts": ["product_id"],
"ref": ["tmall.tmall_discussion.object_id"],
"loops": 50,
"rows": 1,
"cost": 0.03187615,
"filtered": 100,
"attached_condition": "p.product_id in (12,148,5,23,1,149,79,238,239,172,167,8,150,13)",
"using_index": true
}
}
]
}
}
}
}
Result
| product_id |
discussion_amount_posts |
| 1 |
3 |
| 5 |
3 |
| 8 |
1 |
| 23 |
1 |
| 148 |
3 |
| 149 |
3 |
| 150 |
3 |
| 167 |
1 |
| 172 |
1 |
| 238 |
1 |
| 239 |
1 |