sql语句的优化

一、union  与union all

select PropID,PropName from V2DB_MatchCenter..[Game.Prop]  where PropID>0
Union
select ProductID,ProductName from ProductInfo

 

select PropID,PropName from V2DB_MatchCenter..[Game.Prop]  where PropID>0
Union all
select ProductID,ProductName from ProductInfo 

想了个优化方法,因为值不重复,改为union all

 科普一下

union all直接两张表相加,union 取的是合集,没有重复项,
没有重复的意思就是union时有排序去重的操作


 

posted @ 2016-06-16 09:36  晴天MM  阅读(220)  评论(0编辑  收藏  举报