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

关于MySQL 分页limit #79

Closed
dzxiang opened this issue May 23, 2016 · 2 comments
Closed

关于MySQL 分页limit #79

dzxiang opened this issue May 23, 2016 · 2 comments

Comments

@dzxiang
Copy link

dzxiang commented May 23, 2016

翻页的limit能否做个优化: 如果给定了分表键,且只有一个真实表需要做分页,(这时候并不需要在内存中合并排序),那么直接使用原生的SQL语句分页,不要将偏移量改成0。

我们目前的分表策略:一个用户数据一张表,每个用户登录后,只会查询自己的数据,以用户ID作为分表键,定位到的真实表永远只有一张,分页的操作不会跨多表。

@dzxiang
Copy link
Author

dzxiang commented May 26, 2016

我用的是V1.2.0,这个问题可能跟#71号BUG有关,我以为SJ将分页的数据偏移量改为0,需要自己在业务层面分页。

@hanahmily
Copy link
Contributor

目前sjdbc不论是路由到几个目标表,limit全部改为了从偏移量0开始。对于只有一个目标表的情况,应该优化limit,也就是不修改limit后面的偏移量。
这个维护团队后续会做改进,如果您有好的实现方法也欢迎提pull request

@hanahmily hanahmily added this to the limit相关问题修复 milestone Jul 6, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants