TOP versus SET ROWCOUNT

前端 未结 2 586
半阙折子戏
半阙折子戏 2020-12-18 22:15

Is there a difference in performance between TOP and SET ROWCOUNT or do they just get executed in the same manner?

2条回答
  •  长情又很酷
    2020-12-18 22:53

    One more note about performance, according to BOL:

    As a part of a SELECT statement, the query optimizer can consider the value of expression in the TOP or FETCH clauses during query optimization. Because SET ROWCOUNT is used outside a statement that executes a query, its value cannot be considered in a query plan.

    Article on BOL

    Meaning there might be actually performance difference in these.

提交回复
热议问题