performance difference between User Defined Function and Stored Procedures

后端 未结 6 989
终归单人心
终归单人心 2021-01-08 00:28

If a statement return rows doing a simple select over the data base, is there performance difference between implement it using Function and Procedures? I know it is prefera

6条回答
  •  感情败类
    2021-01-08 00:47

    I think you should be less concerned about speed than about how you want to use this function. A UDF can appear elsewhere in a select statement and/or even be used as the "table" to join etc. You can't "select" from a stored procedure or join on one either.

    However, UDFs are called for EVERY ROW so I'd be careful where you use it. This got me in real perf trouble once. So much that I'll never forget.

提交回复
热议问题