微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

数据库 – 存储过程的缺点

想获得使用存储过程的优缺点列表。 SP的主要优点似乎是预编译的,并且是应用程序中的数据抽象。给我你的想法….

解决方法

更正:是否预编译取决于数据库。例如,在sql Server中,它们不是。存储过程和参数化sql都在运行之前进行编译。存储过程有时可以重新使用执行计划,如果存在相应的存储过程,那么参数化sql也是如此。

编辑:Here’s what MSDN says about it

sql Server 2000 and sql Server version 7.0 incorporate a number of changes to statement processing that extend many of the performance benefits of stored procedures to all sql statements. sql Server 2000 and sql Server 7.0 do not save a partially compiled plan for stored procedures when they are created. A stored procedure is compiled at execution time,like any other Transact-sql statement. sql Server 2000 and sql Server 7.0 retain execution plans for all sql statements in the procedure cache,not just stored procedure execution plans.

原文地址:https://www.jb51.cc/mssql/84616.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐