有个SQL视图为
select a1,a2 from a
union
select b1,b2 from b
union
select c1,c2 from c
union
select d1,d2 from d
记录才两万多都要了11秒,怎么能提高效率速度
select a1,a2 from a
union
select b1,b2 from b
union
select c1,c2 from c
union
select d1,d2 from d
记录才两万多都要了11秒,怎么能提高效率速度
解决方案 »
- sqlcmd 连接数据库失败
- 如何在Sendmail函数中发送文本实现换行?
- 请教一个sql的语句
- select * from tbapply where fdid in(select fdcard from rsdata_employee)求一种效率更高的和实现上面功能的SQL语句.
- 为什么我在自定义函数里使用GETDATE()函数会提示‘在函数里不正确的使用了 'getdate'’的错误?
- update可不可以出现在select 的where 条件中
- 请教下mysql数据表合并问题,高手帮忙。
- 求一条sql语句
- 如何在触发器上加上事务回滚?
- 谁知道这种情况怎么写SQL语句啊?狂急!!!!!
- mirror环境下作shrinkfile不起作用
- 关于一个设计思路
2、如果没必要的话,把union改成union all
你可以尝试把union改为union all,时间是否会少一些?
每个语句后面跟上where 最后union all连接效率高
不需要where 改为union all后还是一样,每个表都有主键
2.在这视图上加索引