1、指定分表关键字
例如:int_month int_day,每次查询是必须要带着分表关键字,根据分表关键字确定表明,例如user表,十月份的数据user_202110;
2、使用union all关联多个查询表。
例如:要查询两个的数据 使用union all关联,
(select * from user_202110) UNION all (select * from user_202111);
3、union all 也支持limit, 和offset,
(select * from ohs_trade_records_202110) UNION all (select * from ohs_trade_records_202111) limit 1 offset 1;
4、最终limit 和offset在业务逻辑中限制
每一次判断查询结果的数量,最终在orm层判断是否到达偏移量,确定偏移量后再一条一条查询数据
5、这里分析一份问题,为什么使用数据库的offset和limit;
待讨论