Reputation: 21
Is there any libraries available that can be used to optimize hibernate queries?
I have tried searching for it, but what I found was the ways in which we could optimize sql queries.
Upvotes: 1
Views: 1408
Reputation: 153690
When it comes to JPA and Hibernate, you have to make sure the auto-generated SQL query is as efficient as the one you'd write using plain JDBC.
All in all, you have to analyze the SQL query execution plan and tune the query accordingly.
Now, there are all sorts of tools to help you with this task, like pt-query-advisor for MySQL.
Another option is to use Hypersistence Optimizer, which allows you to optimize your JPA and Hibernate mappings and configurations so that the auto-generated SQL queries are more efficient.
Upvotes: 2
Reputation: 26026
Hibernate optimizes queries itself, you need to fine-tune them by using caching and so on. Of course the most basic thing you can do is to log the sql queries and optimize them. You can also use something to manage your db connection, for example flexy-pool.
Upvotes: 1