自定义的存储过程不要以SP_开头

本文讨论了在SQL Server中使用SP_作为存储过程前缀可能带来的性能问题。当执行带有SP_前缀的存储过程时,SQL Server会首先在master数据库中查找该过程,若未找到再转向当前数据库搜索。这种行为可能导致不必要的响应时间增加,因此建议避免使用SP_作为自定义存储过程的前缀。
 
When creating your own stored procedures, you should not use the sp_ prefix, because when you execute any procedure called sp_.... then SQL Server will assume that the procedure exists in the master database, and only after it can't find the procedure there it will look in the current database. So there's a response time issue (you shouldn't waste SQL Server's precious time).  older than SQL Server 2005


SQL Server 2005:
When you excute SP_* in your database, sql server will call the sp in your database If the SP_* exists in both master and you database.

When you excute SP_* in your database, sql server will call the sp in your master database If the SP_* just exists in master database.


So please don't use the SP_ prefix in your procedures, because it may reduce the performace.

转载于:https://www.cnblogs.com/guothree2003/articles/1214328.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值