本文介绍了驱动查询模式不会导致 N+1 问题吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在spring batch reference中,有一个模式叫做driving query patternhttps://docs.spring.io/spring-batch/4.1.x/reference/html/common-patterns.html#drivingQueryBasedItemReaders

In spring batch reference, there is a pattern called driving query patternhttps://docs.spring.io/spring-batch/4.1.x/reference/html/common-patterns.html#drivingQueryBasedItemReaders

不知道对这个模式有没有误解,驱动查询模式会不会导致N+1问题?

I don't know if I misunderstand this pattern right, doesn't driving query pattern cause N+1 problem?

对我来说,这看起来像是一个经典的 N+1 问题,尤其是它们在 ORM 世界中的做法很糟糕.

It looks like a classic N+1 problem to me, especially they are bad practice in ORM world.

推荐答案

是的.对于每个项目,处理器将发出另一个查询以获取有关当前项目的附加信息.

Yes it does. For each item, the processor will issue another query to grab additional information about the current item.

这篇关于驱动查询模式不会导致 N+1 问题吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 06:04