Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: select count非常慢

[TiDB Usage Environment] Production Environment
[TiDB Version] V6.5.1
[Reproduction Path]
[Encountered Problem: Problem Phenomenon and Impact]
A table with less than 100 million records takes a very long time to execute the following select count query, often taking twenty to thirty seconds. The query condition columns have already been indexed, but the reason for the slowness is unknown.
explain analyze SELECT count(c_ckey)
FROM vm_company_derived_variables_all
WHERE (operated_years > 2)
AND (c_regist_capi > 1000.0)
[Resource Configuration]
One physical machine, virtualized into 10 instances, PD: 3 instances, TIDB: 2 instances, each with 32GB memory, TIKV: 4 instances, each with 32GB memory. SSD hard drive.
[Attachment: Screenshot/Log/Monitoring]
explain analyze as attached
explain.txt (1.8 KB)