您现在的位置是:首页 > 数码 > 

sql 临时表代替left join提高性能

2025-07-17 17:44:30
sql 临时表代替left join提高性能 L表数据量: J表数据量: 原表left join : select count(1) from l left join j on j.userID=l.userid where l.appID=1000 and l.loginTime>=&#

sql 临时表代替left join提高性能

L表数据量:7717975

J表数据量:42201

原表left join :

select count(1) from l left join j on j.userID=l.userid where l.appID=1000 and l.loginTime>=	2018-01-01	 and l.loginTime<	2018-02-01	   

等半天不出结果!


临时 表left join :

select l.* into #tmpfrom l  where l.appID=1000  and l.loginTime>=	2018-01-01	 and l.loginTime<	2018-02-01	   select count(1) from #tmp l left join j on j.userID=l.userid 
查询结果:45459
速度很快!


#感谢您对电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格的认可,转载请说明来源于"电脑配置推荐网 - 最新i3 i5 i7组装电脑配置单推荐报价格

本文地址:http://www.dnpztj.cn/shuma/790997.html

相关标签:无
上传时间: 2024-01-08 10:18:07
留言与评论(共有 7 条评论)
本站网友 青岛皮肤病医院
6分钟前 发表
sql 临时表代替left join提高性能 L表数据量:7717975 J表数据量:42201 原表left join : select count(1) from l left join j on j.userID=l.userid where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01    等半天不出结果! 临时 表left join : select l.* into #tmpfrom l where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01 select count(1) from #tmp l left join j on j.userID=l.userid 查询结果:45459 速度很快!
本站网友 塘沽租房
0秒前 发表
sql 临时表代替left join提高性能 L表数据量:7717975 J表数据量:42201 原表left join : select count(1) from l left join j on j.userID=l.userid where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01    等半天不出结果! 临时 表left join : select l.* into #tmpfrom l where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01 select count(1) from #tmp l left join j on j.userID=l.userid 查询结果:45459 速度很快!
本站网友 利息税怎么算
20分钟前 发表
sql 临时表代替left join提高性能 L表数据量:7717975 J表数据量:42201 原表left join : select count(1) from l left join j on j.userID=l.userid where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01    等半天不出结果! 临时 表left join : select l.* into #tmpfrom l where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01 select count(1) from #tmp l left join j on j.userID=l.userid 查询结果:45459 速度很快!
本站网友 24小时白银价格
28分钟前 发表
sql 临时表代替left join提高性能 L表数据量:7717975 J表数据量:42201 原表left join : select count(1) from l left join j on j.userID=l.userid where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01    等半天不出结果! 临时 表left join : select l.* into #tmpfrom l where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01 select count(1) from #tmp l left join j on j.userID=l.userid 查询结果:45459 速度很快!
本站网友 fect
15分钟前 发表
sql 临时表代替left join提高性能 L表数据量:7717975 J表数据量:42201 原表left join : select count(1) from l left join j on j.userID=l.userid where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01    等半天不出结果! 临时 表left join : select l.* into #tmpfrom l where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01 select count(1) from #tmp l left join j on j.userID=l.userid 查询结果:45459 速度很快!
本站网友 长春泌尿专科医院
12分钟前 发表
sql 临时表代替left join提高性能 L表数据量:7717975 J表数据量:42201 原表left join : select count(1) from l left join j on j.userID=l.userid where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01    等半天不出结果! 临时 表left join : select l.* into #tmpfrom l where l.appID=1000 and l.loginTime>= 2018-01-01 and l.loginTime< 2018-02-01 select count(1) from #tmp l left join j on j.userID=l.userid 查询结果:45459 速度很快!