场景:
应用程序:Springboot,
数据库:MSSQL
表名称:帐户
列数:255
行数:5,00,000
主键(复合):ApplicationNumber,AccountNumber
问题:
当我们使用JPARepository.findAllById(AccountsPk pk)查询传入EmbeddedId的表时,它花费了超过1分钟的时间。
已用时间:<3秒 示例代码:
EntityManager em;
....
...
Query q= em.createQuery(select a from Accounts where a where a.id.accountNumber='xxx' and a.id.applicationNumber='YYYY') ;
List<Accounts> accounts = q.getResultList();
em.close;
与使用entitymanager相比,表具有更多的列/数据时,JpaRepository是否存在任何已知的性能下降限制?