如果有帮助,麻烦点赞支持,拜托🙏。
通常同步时都会有update_time字段,可是并不是所有仅仅使用语句“where update_time>'上一次的更新值'”这么简单,有一些细节需要注意。
update_time可能会有多条数据重复同一个update_time。因为会有数据量比较大的情况,所以必然要分页处理,这时如果只根据update_time这一个字段来处理,那么在分页时会存在漏数据的情况。另外加一个唯一字段,比如id,但可能又有新的错误。
错误的使用:
where update_time>='last_update_time' and id>'...'
这种使用同样会漏掉数据。
正确的做法是:
where (update_time='last_..' and id>'...' ) or update_time>'last_...' order by update_time asc, id asc
如果有帮助,麻烦点赞支持,拜托🙏。