简体   繁体   English

Hibernate 查询优化库

[英]Hibernate query optimization library

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.我试过搜索它,但我发现的是我们可以优化 sql 查询的方法。

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.对于 JPA 和 Hibernate,您必须确保自动生成的 SQL 查询与您使用普通 JDBC 编写的查询一样高效。

All in all, you have to analyze the SQL query execution plan and tune the query accordingly.总而言之,您必须分析SQL 查询执行计划并相应地调整查询。

Now, there are all sorts of tools to help you with this task, like pt-query-advisor for MySQL.现在,有各种工具可以帮助您完成此任务,例如 MySQL 的pt-query-advisor

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.另一种选择是使用Hypersistence Optimizer ,它允许您优化 JPA 和 Hibernate 映射和配置,以便自动生成的 SQL 查询更高效。

Hibernate optimizes queries itself, you need to fine-tune them by using caching and so on. Hibernate 会优化查询本身,您需要通过使用缓存等方式对其进行微调。 Of course the most basic thing you can do is to log the sql queries and optimize them.当然,您可以做的最基本的事情是记录 sql 查询并对其进行优化。 You can also use something to manage your db connection, for example flexy-pool .您还可以使用某些东西来管理您的数据库连接,例如flexy-pool

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM