-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
写文档说明对于分页问题的优化 #130
Labels
Comments
这有什么更好的解决方案么 |
这个问题有好的解决方案或者思路了吗 |
这个方案是有的
|
可以将这个问题写成文档分享出来 |
不用limit,分页的时候使用特定字段(比如使用创建时间)排序,然后分页点使用该字段。这样每一页提取的数据就差不多了。用创建时间排序也不能保证各分表的数据均匀啊,可能某一段很长时间插入的数据都在一个分表。 |
如果是查询倒数页的话,其实不用 “查询全量的结果集,然后移动游标到最后一页”,把 order by asc 改成 desc, 或者 把 desc 改 asc 取前几页就可以了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
分页的查询请求,如果落在了多个库多个表,得到了多个结果集,如果获取最后一页,sjdbc的处理方式是时查询全量的结果集,然后移动游标到最后一页,这样很容易照成内存溢出或大量网络请求的消耗(取决于你设置的fetchsize的大小)。
The text was updated successfully, but these errors were encountered: