当前位置:网站首页>【MYSQL】所有查询表中有2千万数据--sql如何优化
【MYSQL】所有查询表中有2千万数据--sql如何优化
2022-06-28 05:31:00 【weixin_43224306】
这条sql如何优化
所有查询表中有2千万数据
SELECT
*
FROM
(
( SELECT * FROM q_user_01 WHERE id < 1162922 ORDER BY create_time DESC LIMIT 10 ) UNION ALL
( SELECT * FROM q_user_02 WHERE id < 1162922 ORDER BY create_time DESC LIMIT 10 ) UNION ALL
( SELECT * FROM q_user_03 WHERE id < 1162922 ORDER BY create_time DESC LIMIT 10 ) UNION ALL
( SELECT * FROM q_user_04 WHERE id < 1162922 ORDER BY create_time DESC LIMIT 10 ) UNION ALL
( SELECT * FROM q_user_05 WHERE id < 1162922 ORDER BY create_time DESC LIMIT 10 ) UNION ALL
( SELECT * FROM q_user_06 WHERE id < 1162922 ORDER BY create_time DESC LIMIT 10 ) UNION ALL
( SELECT * FROM q_user_07 WHERE id < 1162922 ORDER BY create_time DESC LIMIT 10 ) UNION ALL
( SELECT * FROM q_user_08 WHERE id < 1162922 ORDER BY create_time DESC LIMIT 10 ) UNION ALL
( SELECT * FROM q_user_09 WHERE id < 1162922 ORDER BY create_time DESC LIMIT 10 ) UNION ALL
( SELECT * FROM q_user_10 WHERE id < 1162922 ORDER BY create_time DESC LIMIT 10 )
) AS u
WHERE
u.id < 1162922
ORDER BY
u.create_time DESC
LIMIT 10
执行时间:2.913s
边栏推荐
- 線條動畫
- Is it enough for the project manager to finish the PMP? no, it isn't!
- 小球弹弹乐
- Typescript interface
- How to do a good job of dam safety monitoring
- What are functions in C language? What is the difference between functions in programming and functions in mathematics? Understanding functions in programming languages
- Oracle 条件、循环语句
- How to design an awesome high concurrency architecture from scratch (recommended Collection)
- JS text box loses focus to modify width text and symbols
- sqlmap工具使用手册
猜你喜欢

【LeetCode】12、整数转罗马数字

Study on modified triphosphate: lumiprobe amino-11-ddutp
![[C language practice - printing hollow square and its deformation]](/img/59/9122a6c8437f12bc28c97304ba9787.png)
[C language practice - printing hollow square and its deformation]

RL 实践(0)—— 及第平台辛丑年冬赛季【Rule-based policy】

? How to write the position to output true

How high is the gold content of grade II cost engineer certificate? Just look at this

【C语言练习——打印空心正方形及其变形】

MySQL 45讲 | 05 深入浅出索引(下)

Oracle 常用基础函数

Linked list in JS (including leetcode examples) < continuous update ~>
随机推荐
What is the difference between AC and DC?
8VC Venture Cup 2017 - Elimination Round D. PolandBall and Polygon
How to do a good job of dam safety monitoring
msa. h: There is no such file or directory
Oracle 条件、循环语句
Comparison between relational database and document database
Steve Jobs' speech at Stanford University -- follow your heart
【JVM】——JVM中內存劃分
gorm事务体验
【C语言练习——打印空心正方形及其变形】
How to develop the language pack in the one-to-one video chat source code
Lumiprobe cell imaging analysis: PKH26 cell membrane labeling kit
[Linux] - using xshell to install MySQL on Linux and realize the deployment of webapp
ERP软件公司选型的重要根据
中小型水库大坝安全自动监测系统解决方案
电子邮件营销的优势在哪里?为什么shopline独立站卖家如此重视?
Deeplearning ai-week1-quiz
Docker installs mysql5.7 and starts binlog
如何在您的Shopify商店中添加实时聊天功能?
博客登录框