当前位置:网站首页>There is a problem with MySQL paging
There is a problem with MySQL paging
2022-07-28 06:05:00 【Performer】
Error problem : Query the list of billing records , One less order appears , And repeat an order
The pseudocode is as follows :
SELECT
id
FROM
xxx
ORDER BY
updated_time DESC,
created_time DESC
LIMIT 0,10;

SELECT
id
FROM
xxx
ORDER BY
updated_time DESC,
created_time DESC
LIMIT 10,10;

The reason is : Values in two sort fields , In the case of consistency .order by The order of sorting will be randomly selected
On page one 10 Bits are given randomly A At the beginning id,11 Here you are B At the beginning id
On page two 10 Gave the beginning B Of id, The first 11 Here you are A At the beginning id
As a result, a piece of data was lost , Repeated a piece of data
resolvent :order by Sorting gives a unique value , For example, a primary key id , They won't let it mysql Choose one at random
SELECT
id
FROM
xxx
ORDER BY
updated_time DESC,
created_time DESC,
id DESC
LIMIT 0,10;

SELECT
id
FROM
xxx
ORDER BY
updated_time DESC,
created_time DESC
LIMIT 10,10;

边栏推荐
- Sqoop安装及使用
- 分布式集群架构场景优化解决方案:分布式调度问题
- mysql5.6(根据.ibd,.frm文件)恢复单表数据
- Books - investment ideas and Strategies
- Use Python to encapsulate a tool class that sends mail regularly
- Notice of attack: [bean Bingbing] send, sell, cash, draw, prize, etc
- Hit your face ins? Mars digital collection platform explores digital collection light social networking
- Assembly打包
- No module named yum
- 【二】redis基础命令与使用场景
猜你喜欢

分布式集群架构场景优化解决方案:分布式ID解决方案

7月7日国风廿四节气《小暑》来袭!!附..合..成..预..告..

万变不离其宗-掌控者靶场之bluecms1.6漏洞

Distributed cluster architecture scenario optimization solution: distributed ID solution

浅拷贝、深拷贝区别

【六】redis缓存策略

记某淘宝客软件分析拿库思路

分布式集群架构场景优化解决方案:分布式调度问题

At the moment of the epidemic, online and offline travelers are trapped. Can the digital collection be released?

手撸一个简单的RPC(<-_<-)
随机推荐
Notice of attack: [bean Bingbing] send, sell, cash, draw, prize, etc
分布式锁-Redis实现
第八章 聚合函数
微信小程序开发语言一般有哪些?
Manually create a simple RPC (< - < -)
raise RuntimeError(‘DataLoader worker (pid(s) {}) exited unexpectedly‘.format(pids_str))RuntimeErro
tcp和udp的区别和联系
Invalid packaging for parent POM x, must be “pom“ but is “jar“ @
微信小程序开发费用制作费用是多少?
1: Enable slow query log and find slow SQL
Distributed cluster architecture scenario optimization solution: session sharing problem
Data warehouse tool superset installation (fully available)
Phoenix
Trino function tag
初识Flask
Redis 主从架构的搭建
Kotlin语言现在怎么不火了?你怎么看?
记录下在线扩容服务器遇到的问题 NOCHANGE: partition 1 is size 419428319. it cannot be grown
Installation and use of flinkx
数字藏品的生意没那么好做