Giter Site home page Giter Site logo

Comments (7)

zsword avatar zsword commented on June 27, 2024

是不是根据页数计算数据开始序号那有问题?

from mybatis-shards.

fengkuok avatar fengkuok commented on June 27, 2024

@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.

zsword avatar zsword commented on June 27, 2024

直接建试图,或者全部合并,再分页查询吧。

from mybatis-shards.

fengkuok avatar fengkuok commented on June 27, 2024

@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.

songjiesdnu avatar songjiesdnu commented on June 27, 2024

作者这个问题最终怎么解决的?

from mybatis-shards.

bwzhang2011 avatar bwzhang2011 commented on June 27, 2024

这个当前解决得怎么样了

from mybatis-shards.

fengkuok avatar fengkuok commented on June 27, 2024

@songjiesdnu @bwzhang2011

这个问题在框架层面基本没有什么好的办法解决。有几种方案供大家参考:
1、假分页,根据结果重新计算。
2、将数据同步到NoSQL、Solr等进行跨分区查询。
3、从业务上避免类似操作。

from mybatis-shards.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.