Query time 0.00994
JSON explain
{
"query_block": {
"select_id": 1,
"cost": 0.057931181,
"nested_loop": [
{
"table": {
"table_name": "p",
"access_type": "range",
"possible_keys": ["PRIMARY"],
"key": "PRIMARY",
"key_length": "3",
"used_key_parts": ["product_id"],
"loops": 1,
"rows": 4,
"cost": 0.00328865,
"filtered": 100,
"attached_condition": "p.product_id in (23,24,22,25)",
"using_index": true
}
},
{
"table": {
"table_name": "tmall_discussion",
"access_type": "eq_ref",
"possible_keys": ["PRIMARY", "object_id"],
"key": "object_id",
"key_length": "6",
"used_key_parts": ["object_id", "object_type"],
"ref": ["tmall.p.product_id", "const"],
"loops": 4,
"rows": 1,
"cost": 0.007120904,
"filtered": 100,
"index_condition": "tmall_discussion.object_type = 'P'"
}
},
{
"table": {
"table_name": "dp",
"access_type": "ref",
"possible_keys": ["thread_id", "thread_id_2"],
"key": "thread_id",
"key_length": "3",
"used_key_parts": ["thread_id"],
"ref": ["tmall.tmall_discussion.thread_id"],
"loops": 4,
"rows": 6,
"cost": 0.032160624,
"filtered": 100,
"attached_condition": "dp.`status` = 'A'"
}
}
]
}
}
Result
| product_id |
discussion_amount_posts |
| 23 |
1 |