List<UserModel> userModels = UserModelRespository.findByRegisteredAndCreateTimeLessThan("1",start); for (UserModel userModel: userModels) { OtherModel othermodel = getOtherModel(userModel); }
其中通过数据库查询出来的userModels会有几十万条数据,用foreach遍历的话会有什么影响,有什么解决办法
List<UserModel> userModels = UserModelRespository.findByRegisteredAndCreateTimeLessThan("1",start); for (UserModel userModel: userModels) { OtherModel othermodel = getOtherModel(userModel); }
其中通过数据库查询出来的userModels会有几十万条数据,用foreach遍历的话会有什么影响,有什么解决办法