From the looks of the query, my guess is that you are looking up all the defined columns in INFORMATION_SCHEMA.COLUMNS
that are defined as INT
.
The reason why there was a lock on INFORMATION_SCHEMA.COLUMNS
???
The table INFORMATION_SCHEMA.COLUMNS
is defined as a temporary memory table. Memory tables undergo full tables locks when being accessed for change (such as when one does ALTER TABLE
or CREATE TABLE
) from anywhere in the database,
Here is an excerpt from my old post How is INFORMATION_SCHEMA implemented in MySQL?
All tables in the INFORMATION_SCHEMA database are stored directly in memory as MEMORY storage engine tables. They are totally internal to MySQL, so the .frm mechanisms are handled in mysqld. In my answer, I first showed the table layout of INFORMATION_SCHEMA.TABLES. It is a temporary table in memory. It is manipulated using storage engine protocols. Thus, when mysqld is shutdown, all information_schema tables are dropped. When mysqld is started, all information_schema tables are created as TEMPORARY tables and repopulated with metadata for every table in the mysql instance.
Please note what is in bold
It is a temporary table in memory. It is manipulated using storage engine protocols.
When you look up the MEMORY storage engine in the Docs, it shows that Lock Granularity is Table. So, every table in the INFORMATION_SCHEMA, including INFORMATION_SCHEMA.COLUMNS
will received a lock at some point, EVEN FOR A SELECT (just like a MyISAM table).