存储过程与参数绑定
我在 Visual C++ 中使用 SQL Server 和 ODBC 来写入数据库。目前我在 SQL 查询中使用参数绑定(因为我只用 5 - 6 个查询填充数据库,检索数据也是如此)。我对存储过程了解不多,我想知道存储过程是否比参数绑定有多少性能提升,因为在参数绑定中,我们只准备一次查询,然后在程序中针对不同的变量值集执行它。
I am using SQL server and ODBC in visual c++ for writing to the database. Currently i am using parameter binding in SQL queries ( as i fill the database with only 5 - 6 queries and same is true for retrieving data). I dont know much about stored procedures and I am wondering how much if any performance increase stored procedures have over parameter binding as in parameter binding we prepare the query only once and just execute it later in the program for diferent set of values of variables.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于以下几个原因,存储过程应该具有更高的性能:
另一个优点是您可以更改数据库上的查询,而无需重新编译代码。这是一个额外的抽象层,我发现它非常有用。
Stored procedures should be more performant for a few reasons:
Another advantage is that you can alter the query on the DB without having to recompile the code. This is an additional layer of abstraction that I find very useful.