Venu Chitta
Venu Chitta

Reputation: 300

Hibernate queries slow than native queries in MySQL

I am working on a project which involves MySQL database which has billions of rows and building a Java based application on top of it. I am using Hibernate as ORM. While I execute a complex query on MySQL it is taking about 2.5 secs to execute where as in Hibernate the same query is taking about 8.9 secs. Are there any settings I need to change to reduce the execution time in Hibernate?

Upvotes: 0

Views: 248

Answers (1)

user4255955
user4255955

Reputation:

Hibernate is a bit slower than native - that's to be expected... Have you defined the indexes properly? Are you using lazy loading (you should be). What query is hibernate spitting out to fetch your data compared to the native (use hibernate.show_sql=true)

Upvotes: 1

Related Questions