如果查询的结果少,可以把查询结果当子集,再查另一张表,比join的速度快得多得多
2024-10-21 00:19:48
select up.UP_NAME as printName,count(1) as qty from riv_print_history_l phl JOIN tab_user_profile up
on up.UP_USER_ID = phl.PHL_PRINT_USER_ID
where
phl.CREATE_TIME >= '2017-00-15 00:00:00' and phl.CREATE_TIME < '2017-09-21 00:00:00'
GROUP BY phl.PHL_PRINT_USER_ID; select
(select UP_NAME from tab_user_profile where UP_USER_ID = tab1.PHL_PRINT_USER_ID)
as printName,tab1.qty from
(select PHL_PRINT_USER_ID,count(1) as qty from riv_print_history_l
where CREATE_TIME >= '2017-00-15 00:00:00' and CREATE_TIME < '2017-09-21 01:00:00' GROUP BY PHL_PRINT_USER_ID)tab1;
tab_user_profile 116行
riv_print_history_l 640746行
select PHL_PRINT_USER_ID,count(1) as qty from riv_print_history_l
where CREATE_TIME >= '2017-00-15 00:00:00' and CREATE_TIME < '2017-09-21 01:00:00' GROUP BY PHL_PRINT_USER_ID
查出的结果只有3行
第一个用时10s,第二个用时0.6s
最新文章
- PIC32MZ tutorial -- 32-bit Timer
- JAVA学习<;六>;
- Codeforces Round #207 (Div. 2) A. Group of Students
- git branch分支管理用法总结
- LDAP协议介绍
- 警惕使用WebClient.DownloadFile(string uri,string filePath)方法
- oracle 12c 学习系列(1)–12c初体验
- hdfs格式化hadoop namenode -format错误
- eclipse安装checkstyle无法加载到preferences的问题
- css正三角倒三角
- Python 元组内置函数
- 【翻译】Ext JS最新技巧——2014-8-13
- 开源分布式数据库SequoiaDB在去哪儿网的实践
- 入门 Webpack,一篇就够了
- form组件
- ivew定制主题 less ^3.0 时报错 .bezierEasingMixin(); Inline JavaScript is not enabled. Is it set in your options?
- Dubbo和Spring Cloud微服务架构对比
- expect自动化工具
- Python3 tkinter基础 Canvas coords 移动直线,itemconfig 设置矩形的颜色, delete 删除一条直线
- 1.3用socketserver创建服务器
热门文章
- CSS实现简单无缝滚动
- HihoCoder1655 : 第K小最简真分数([Offer收割]编程练习赛39)(唯一分解+容斥定理+二分)(不错的数学题)
- 洛谷 1979 华容道——最短路+dp
- vijos:P1053Easy sssp(spfa判环)
- 2、R-reshape2-melt
- 《Java多线程编程核心技术》读后感(九)
- gSoap使用入门(2)----自定义接口头文件
- 微信小程序开发之带搜索记录的搜索框
- LIS与LCS的nlogn解法
- POJ - 1458 Common Subsequence DP最长公共子序列(LCS)