Query time 0.01703
JSON explain
{
"query_block": {
"select_id": 1,
"cost": 0.143289968,
"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": 10,
"cost": 0.007089212,
"filtered": 100,
"attached_condition": "p.product_id in (131,152,160,122,115,129,127,124,150,151)",
"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": 10,
"rows": 1,
"cost": 0.01749506,
"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": 10,
"rows": 6,
"cost": 0.08009436,
"filtered": 100,
"attached_condition": "dp.`status` = 'A'"
}
}
]
}
}
Result
| product_id |
discussion_amount_posts |
| 150 |
3 |