Details
- 
    
Bug
 - 
    Status: Closed (View Workflow)
 - 
    
Major
 - 
    Resolution: Fixed
 - 
    1.1.2
 - 
    None
 - 
    None
 
Description
We have experienced performance issues (relative to the MySQL Connector/J) when performing a Hibernate SchemaUpdate on a database with ~300 tables.
This has been tracked down to the difference in performance of DatabaseMetaData.getImportedKeys() between the two drivers. First with mariadb:
					time java -cp .:/opt/jboss7/modules/org/mariadb/main/mariadb-java-client-1.1.2.jar MariaDBMetadata
			 | 
		
					Added tables [327]
			 | 
		
					...
			 | 
		
| 
					 | 
		
					real	2m7.308s
			 | 
		
					user	0m0.849s
			 | 
		
					sys	0m0.150s
			 | 
		
And then with MySQL Connector/J:
					$ time java -cp .:/opt/jboss7/modules/com/mysql/main/mysql-connector-java-5.1.21-bin.jar MariaDBMetadata
			 | 
		
					Added tables [327]
			 | 
		
					...
			 | 
		
| 
					 | 
		
					real	0m1.435s
			 | 
		
					user	0m1.312s
			 | 
		
					sys	0m0.125s
			 | 
		
127sec vs 1.5s.
The attached example code gets the each table defined, and then calls getImportedKeys() on each one in turn.
Given the performance penalty of querying the information schema, it would probably be quicker to parse the output of 'show create table'.