简体   繁体   English

休眠性能问题:查询执行速度极慢

[英]Hibernate performance issue: query execution extremely slow

The following hibernate query is being used to fetch a list of ProductCatalogue records, by passing in catId and inventoryId 以下休眠查询通过传递catId和ventoryId来获取ProductCatalogue记录的列表

select prodcat from ProductCatalogue prodcat where prodcat.prodSec.prodId=:catId and prodcat.prodPlacedOrder.inventoryId=:inventoryId

The tables ProductCatalogue and ProdPlacedOrder are tables with 3 lakh + records. 表ProductCatalogue和ProdPlacedOrder是具有30万以上记录的表。 inventoryId is a column in prodOrder table, and prodPlacedOrder extends prodOrder table. 库存编号是prodOrder表中的一列,prodPlacedOrder扩展了prodOrder表。

This query on execution takes a lot of time, and the single hibernate query shoots off many complex sql queries. 执行该查询需要花费大量时间,并且单个休眠查询会引发许多复杂的SQL查询。

Any suggestions on what might be the issue and how to modify it such that the query is executed faster? 关于可能是什么问题以及如何对其进行修改以便更快地执行查询的任何建议?

Difficult to say without more info but try making ProdPlacedOrder as LAZY fetch if you dont need any data from that table. 很难说,没有更多信息,但是如果不需要该表中的任何数据,请尝试使ProdPlacedOrder作为LAZY获取。

Also as phatmanace, mentioned - check your indices. 还提到了phatmanace-检查您的索引。

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

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