MySQL 中的偏移分页使用 ORDER BY Date 返回不一致的结果
我最近发现我在 MySQL 中的分页查询在某种程度上被破坏了,经过一些研究,我倾向于相信它来自于我通过 DATETIME 字段对行进行分页这一事实。我的问题是有些行显示在多个页面中,有些行在我的页面中一次不显示。
我的查询通常如下所示:SELECT * FROM Table ORDER BY start ASC LIMIT 12 OFFSET 12
。 start
列是 DATETIME 并且正在使用索引。
据我了解,问题可能来自于多行(数十行)具有完全相同的 start
值。我想在这里问一下,你们中的一些人是否已经遇到过这种情况,并且希望知道该怎么做来纠正这种行为?
预先感谢您的帮助!
I have recently found that my pagination queries in MySQL are somehow broken and, after some research, I tend to believe it comes from the fact that I paginate my rows by a DATETIME field. My issue is that some rows are shown in multiple pages and some are not shown once in my pages.
My queries typically look like that: SELECT * FROM Table ORDER BY start ASC LIMIT 12 OFFSET 12
. The start
column is a DATETIME and is using an index.
As far as I understand, the issue might come from the fact that multiple rows (dozens) have the exact same start
value. I would like to ask here if some of you already faced such a situation and hopefully know what to do to correct this behavior ?
Thanks in advance for your help !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论