如何在多个Mysql服务器上设置限制和偏移?

时间:2017-02-27 07:21:55

标签: java mysql

我有一个学生页面我想添加一个简单的分页但问题是学生信息来自不同的mysql服务器。为此页面添加分页的最佳方法是什么?

RequestMapping(value = "loadStudents.json", method = RequestMethod.POST)
@ResponseBody
public String loadStudents(HttpServletRequest request, HttpServletResponse response){
   int offset = ...
   int limit = ....

   for(Server server : mysqlServers){  //I got 3 server here
      studentService.getStudents(server, offset, limit);
   }
}

编辑:不同服务器上的所有学生表具有相同的表架构;

[id, name, surname, information, address]

目前我有3台Mysql服务器,但我可以拥有更多服务器。服务器大小不在我的控制之下。

显示学生信息并不重要。我的意思是如果我每页有5条记录;

student22(from server1)
student11(from server1)
student42(from server1)
student11(from server1)
student33(from server1)

OR

student1(from server1)
student22(from server2)
student334(from server3)
student44(from server1)
student444(from server3)

0 个答案:

没有答案