During startup phase, Hibernate relies on "SHOW FULL TABLES" to discover the schema.
It executes the same command multiple times for the same table. As the execution time can vary between 100 and 200 ms on a loaded server, this can lead to very long startup times in the range of minutes. The duplication can be observed both in 4.3.11 and 5.2.3 however in the later one, it's more severe. Below is an example of number of queries observed for a complex schema with around 120 tables.
Hibernate 4.3.11: 232 x SHOW FULL TABLES FROM
Hibernate 5.2.3: 591 x SHOW FULL TABLES FROM
In 5.2.3, the number of queries executed for same table varies. We have one table for which we see the same query 19 times!
All the queries can be easily observed by enabling general log in Mysql. The issue might be related to HHH-11023 Closed