Mysql – Why are there no indexes contained in the information_schema database

MySQL

For the information schema.processlist:

enter image description here

Why are there no indexes on any of the fields (for example, a pk on ID)? Is this something that is not written through 'via sql' and is only reading directly from the storage layer to show the stats, or why isn't this table (and all other information_schema tables) constructed like a normal relational table?

And from the top of the mysql docs about them:

The INFORMATION_SCHEMA database contains several read-only tables. They are actually views, not base tables, so there are no files associated with them, and you cannot set triggers on them. Also, there is no database directory with that name

Best Answer

Also the way the information schema tables is generated internally means that the entire table is generated before a single attempt at filtering is done on the table.

An index has no meaningful effect on information_schema tables.

So for performance considerations, don't overly use information_schema tables, there could be performance impacts on the entire system.

note: above refers to MySQL-5.7 and MariaDB information_schema. I haven't looked at the MySQL-8.0 implementatoin.