Hello Lukas, thx for the quick response.
Turning on logging (should have come up with that myself ;)) it turns out jooq
is doing exactly what you said:
Executing query : select `information_schema`.`KEY_COLUMN_USAGE`.`CONSTRAINT_NAME`, `information_schema`.`KEY_COLUMN_USAGE`.`TABLE_NAME`, `information_schema`.`KEY_COLUMN_USAGE`.`COLUMN_NAME` from `information_schema`.`KEY_COLUMN_USAGE` join `information_schema`.`TABLE_CONSTRAINTS` on (`information_schema`.`KEY_COLUMN_USAGE`.`TABLE_SCHEMA` = `information_schema`.`TABLE_CONSTRAINTS`.`TABLE_SCHEMA` and `information_schema`.`KEY_COLUMN_USAGE`.`TABLE_NAME` = `information_schema`.`TABLE_CONSTRAINTS`.`TABLE_NAME` and `information_schema`.`KEY_COLUMN_USAGE`.`CONSTRAINT_NAME` = `information_schema`.`TABLE_CONSTRAINTS`.`CONSTRAINT_NAME`) where (`information_schema`.`TABLE_CONSTRAINTS`.`CONSTRAINT_TYPE` = 'PRIMARY KEY' and `information_schema`.`KEY_COLUMN_USAGE`.`TABLE_SCHEMA` = 'vm144_amazon') order by `information_schema`.`KEY_COLUMN_USAGE`.`TABLE_NAME` asc, `information_schema`.`KEY_COLUMN_USAGE`.`ORDINAL_POSITION` asc
And exactly here is the problem I think: we use one DB for all our vms (around 100) an each vm has a separate schema for all components.
Those are quite a few hundred tables in the end. I tried reducing the query to the minimun: SELECT * from `information_schema`.`KEY_COLUMN_USAGE` LIMIT 50
but this statement runs 'forever' as well. Because I got no idea about this information_schema I searched and found this page:
http://www.pythian.com/blog/how-to-tell-when-using-information_schema-might-crash-your-database/and doing an EXPLAIN ..... showed: 'Open_full_table; Scanned all databases'
So I think it is not hanging but just will take forever to complete that statement (if the DB doesn't crash before or runs into a timeout).
Do you perhaps have any idea, if I can work around this in case my assumption is right? Perhaps limit it only to query one schema?
Thx,
Oliver