简体   繁体   English

如何在MySql数据库中使用Hiberante框架提高Web应用程序中的搜索性能

[英]How to improve search performance in web application using Hiberante framework with MySql Database

I'm developing web application using Hiberante ORM tool and MySql database and i'm trying to search data from multiple tables among 2 lacks of data its taking longer time to search data, so please any one suggest me to improve performance of search (using Hibernate ORM tool and MySql DB) or should i use any searching functionality for it. 我正在使用Hiberante ORM工具和MySql数据库开发Web应用程序,并且我试图从2个缺少数据的多个表中搜索数据,这需要花费较长的时间来搜索数据,因此请有人建议我提高搜索性能(使用Hibernate ORM工具和MySql DB)还是我应该为其使用任何搜索功能。

Thanking You All 谢谢大家

To start with, log the generated SQL queries using the option: 首先,使用以下选项记录生成的SQL查询:

<property name="show_sql">true</property>

Viewing the SQL you can detect if there are unnecessary joins, or unnecessary loads data. 查看SQL,您可以检测到是否存在不必要的联接或不必要的加载数据。 Then, modify your mapping or the way that you build your queries. 然后,修改您的映射或构建查询的方式。

Maybe, you'll face the classic N+1 query problem 也许您会遇到经典的N + 1查询问题

  1. Add indexes; 添加索引;
  2. Replace FetchType.EAGER by FetchType.LAZY. 用FetchType.LAZY替换FetchType.EAGER。

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

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