Performance effect of using TOP 1 in a SELECT query

前端 未结 4 823
挽巷
挽巷 2021-02-12 10:28

I have a User table where there are a Username and Application columns. Username may repeat but combination of Username + Application is unique, but I don\'t have the unique con

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-12 11:12

    I think it depends on the query execution plan that SQL generates ... In the past on previous versions of SQL Server I have seen the use of a superfluous 'TOP' deliver definite performance benefits with complex queries with many joins. But definitely not in all cases.

    I guess the best advice I can give is to try it out on a case by case basis.

提交回复
热议问题