Query time 0.00904
JSON explain
{
"query_block": {
"select_id": 1,
"cost": 0.030193974,
"nested_loop": [
{
"table": {
"table_name": "absolute_rating",
"access_type": "system",
"possible_keys": ["PRIMARY"],
"rows": 0,
"filtered": 0,
"const_row_not_found": true
}
},
{
"table": {
"table_name": "tmall_companies",
"access_type": "ALL",
"loops": 1,
"rows": 2,
"cost": 0.01034841,
"filtered": 100,
"attached_condition": "tmall_companies.`status` = 'A'"
}
},
{
"table": {
"table_name": "tmall_discussion",
"access_type": "eq_ref",
"possible_keys": ["object_id"],
"key": "object_id",
"key_length": "6",
"used_key_parts": ["object_id", "object_type"],
"ref": ["tmall.tmall_companies.company_id", "const"],
"loops": 2,
"rows": 1,
"cost": 0.003662852,
"filtered": 100,
"attached_condition": "trigcond(tmall_discussion.object_id = tmall_companies.company_id and tmall_discussion.object_type = 'M')"
}
},
{
"table": {
"table_name": "tmall_discussion_posts",
"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": 2,
"rows": 6,
"cost": 0.016182712,
"filtered": 100,
"attached_condition": "trigcond(tmall_discussion_posts.`status` = 'A' and trigcond(tmall_discussion.thread_id is not null))"
}
}
]
}
}
Result
| COUNT(DISTINCT(tmall_companies.company_id)) |
| 2 |