Comments (7)
是不是根据页数计算数据开始序号那有问题?
from mybatis-shards.
@zsword 错的一塌糊涂啊!
比如:
t_1表中数据id为1,3,5,7,9
t_2表中数据id为2,4,6,8,10
现在想每页显示两条数据,根据sql语句,我从t_1表中查询出数据为1,3。t_2表查询出数据2,4。
合并,排序后最终获得数据id为1,2。
翻第二也的时候。t_1查询出5,7。t_2查询出6,8。已经直接丢掉数据3和4了!
有没有什么好的算法?
from mybatis-shards.
直接建试图,或者全部合并,再分页查询吧。
from mybatis-shards.
@zsword
同库分表的话视图可以解决,但是没有并行查询,效率是问题。
不同库的话就麻烦了。hibernate shards里也有这个问题,竟然没有解决!
在 2012-11-1 上午9:52,"周士淳" [email protected]写道:
直接建试图,或者全部合并,再分页查询吧。
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/8#issuecomment-9968573.
from mybatis-shards.
作者这个问题最终怎么解决的?
from mybatis-shards.
这个当前解决得怎么样了
from mybatis-shards.
这个问题在框架层面基本没有什么好的办法解决。有几种方案供大家参考:
1、假分页,根据结果重新计算。
2、将数据同步到NoSQL、Solr等进行跨分区查询。
3、从业务上避免类似操作。
from mybatis-shards.
Related Issues (15)
- UserDaoTests单元测试中3个方法无法通过
- 单元测试重构
- 扩展Spring schema
- TRUNCATE 在myBatis中怎么使用? HOT 10
- when mybatis-shards for G.A releasing ? HOT 9
- 请问作者,这个有没有在生产上使用的案例 HOT 6
- 有没有使用文档? HOT 1
- 欢迎大家来一起讨论
- 1.0.0-SNAPSHOT版本是否有连接未close(未归还连接池)的问题? HOT 1
- 去除Assert等基本操作对spring的过于依赖
- 对order by语句的支持
- 增加对类似于JPA生命周期事件的支持
- 实现纵向切分
- shardedSqlSessionFactory需要配置多个ShardStrategyFactory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mybatis-shards.