当前位置:网站首页>【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
边栏推荐
- Gee learning notes 3- export table data
- Performance degradation during dpdk source code testing
- 数据仓库:DWS层设计原则
- [Linux] - using xshell to install MySQL on Linux and realize the deployment of webapp
- Detailed usage configuration of the shutter textbutton, overview of the shutter buttonstyle style and Practice
- Oracle 条件、循环语句
- Shutter nestedscrollview sliding folding head pull-down refresh effect
- Application of Beidou No.3 short message terminal in dam safety monitoring scheme
- Why does the company choose cloud database? What is its charm!
- 数据中台:数据治理的七把利剑
猜你喜欢

jsp连接Oracle实现登录注册

Docker installs mysql5.7 and starts binlog

To batch add background pictures and color changing effects to videos

線條動畫

What is the difference between AC and DC?

How to learn programmable logic controller (PLC)?

2022 new version NFT source code source code of China meta universe digital collection art trading platform

【无标题】drv8825步进电机驱动板子原理图

Function reentry caused by Keil C51's data overlaying mechanism

电商转化率这么抽象,到底是个啥?
随机推荐
Error: the following arguments are required:
Deeplearning ai-week1-quiz
数据中台:数据治理的七把利剑
【LeetCode】12、整数转罗马数字
Metartc5.0 API programming guide (I)
8VC Venture Cup 2017 - Elimination Round D. PolandBall and Polygon
【Linux】——使用xshell在Linux上安装MySQL及实现Webapp的部署
Object detection with OpenCV
线条动画
Application of Beidou No.3 short message terminal in dam safety monitoring scheme
Informatics Orsay all in one 1360: strange lift
证明素数/质数有无限多个
The heading angle of sliceplane is the same as that of math Corresponding transformation relation of atan2 (y, x)
2022 new version NFT source code source code of China meta universe digital collection art trading platform
如何在您的Shopify商店中添加实时聊天功能?
Solution of dam safety automatic monitoring system for medium and small reservoirs
Zzuli:1072 frog climbing well
Line animation
Typescript base type
Keil C51的Data Overlaying机制导致的函数重入问题