To union or union all, that is the question

前端 未结 5 1445
有刺的猬
有刺的猬 2021-02-20 16:38

I have two queries that I\'m UNIONing together such that I already know there will be no duplicate elements between the two queries. Therefore, UNION a

5条回答
  •  南方客
    南方客 (楼主)
    2021-02-20 17:32

    According to http://blog.sqlauthority.com/2007/03/10/sql-server-union-vs-union-all-which-is-better-for-performance/ at least for performance it is better to use UNION ALL, since it does not actively distinct duplicates and as such is faster

提交回复
热议问题