Query time 0.00787
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 (70,156,175,43,76,56,57,30,246,173,67,25,154,53,52,161,165,166)",
"using_index": true
}
}
]
}
}
}
}
Result
| product_id |
discussion_amount_posts |
| 246 |
3 |