Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

流式查询是不是一次读取全部数据到内存了? #5849

Closed
jyjey opened this issue Dec 18, 2023 · 5 comments
Closed

流式查询是不是一次读取全部数据到内存了? #5849

jyjey opened this issue Dec 18, 2023 · 5 comments
Labels

Comments

@jyjey
Copy link

jyjey commented Dec 18, 2023

当前使用版本(必填,否则不予处理)

mybatisplus:3.5.4.1
spring:2.7.6

该问题是如何引起的?(确定最新版也有问题再提!!!)

使用流式查询27w数据时表象正常,200W数据时还是发生了内存溢出
打印sql发现多次执行查询语句,怀疑是不是先加载了全部数据到内存,然后再逐条读取的?

重现步骤(如果有就写完整)

报错信息

内存溢出

@nieqiurong
Copy link
Contributor

不是,具体可以查ResultHandler原理

@jyjey
Copy link
Author

jyjey commented Dec 19, 2023

但是200W没有分页的情况单纯的依赖流式查询,确实发生了内存溢出,是不是有其他需要注意的文档中没有写?

@nieqiurong
Copy link
Contributor

没什么其他要注意点,这要取决你查出来后面做了什么,你又把这数据依次保存在list里什么的,就只能调整你的堆内存,正常情况下是处理一条丢一条.

@bearnew
Copy link

bearnew commented Aug 6, 2024

@jyjey 大佬解决了吗,我现在也是流式查询百万条数据,内存上涨明显,且没有被回收

@elcnu986
Copy link

@jyjey 大佬解决了吗,我现在也是流式查询百万条数据,内存上涨明显,且没有被回收

首先确定是不是真的是流式查询
#6485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants