tidb
tidb copied to clipboard
query information_schema.ddl_jobs is very slow
Feature Request
Is your feature request related to a problem? Please describe:
We'd like to query the tidb to know the ddl job status, by running the following query, it takes more than 20 seconds return the result, it's too slow.
SELECT JOB_ID, JOB_TYPE, SCHEMA_STATE, SCHEMA_ID, TABLE_ID, STATE, QUERY
FROM information_schema.ddl_jobs
WHERE DB_NAME = "%s"
AND TABLE_NAME = "%s"
AND JOB_TYPE LIKE "add index%%"
AND (STATE = "running" OR STATE = "queueing")
LIMIT 1;
Describe the feature you'd like:
The query above should return result very quick.
Describe alternatives you've considered:
Teachability, Documentation, Adoption, Migration Strategy:
ref https://github.com/pingcap/tiflow/issues/11521