查询导致内存溢出优化

报错信息

org.springframework.web.util.NestedServletException: 
Handler dispatch failed; nested exception is java.lang.OutOfMemoryError:Java heap space

出现原因

        //查询了大量的userId  
        List loanUserIds = bidMapper.findLoanUserIds();
        //将userId作为参数继续查询
        List loanUserDistributes = usersMapper.findUserDistribute(loanUserIds, loanUserIds.size());
    

解决方案

//将结果在sql中直接查出
List loanUserDistributes = usersMapper.findUserDistribute();
    

 

你可能感兴趣的:(数据库)