Mysql.tidb_mdl_view cannot view information related to truncate blocking DDL

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: mysql.tidb_mdl_view 无法查看truncate 阻塞 DDL 的相关信息

| username: Raymond

Version: v6.5.3

session 1
begin;
select * from monitor;

session 2

truncate table monitor;

session 3

select * from mysql.tidb_mdl_view;

It was found that there were no related records in tidb_mdl_view queried in session 3, but there was indeed related DDL blocking.

If the DDL executed in session 2 adds an index (alter table monitor add index index_name(name);), there are related records in tidb_mdl_view.

Conclusion: It is hoped that when executing truncate causes MDL blocking, related records can also be found in tidb_mdl_view.

| username: Fly-bird | Original post link

Sometimes there is none, show processlist.