- Learn T-SQL Querying
- Pedro Lopes Pam Lahoud
- 221字
- 2021-06-24 14:38:12
Stored procedures
A stored procedure is a group of one or more T-SQL statements that is stored as an object in a SQL Server database. Stored procedures are like procedures in other programming languages in that they can accept input parameters and return output parameters, they can contain control-flow logic, such as conditional statements (IF … ELSE), loops (WHILE), and error handling (TRY … CATCH), and they can return a status value to the caller that indicates success or failure. They can even contain calls to other stored procedures. There are many benefits to using stored procedures, but in this section, we will focus mainly on their benefit of reducing the overhead of the compilation process through caching.
The first time a stored procedure is executed, SQL Server compiles and optimizes the T-SQL within the procedure, and the resulting execution plan is cached for future use. Every subsequent call to the procedure reuses the cached plan, until the plan is removed from the cache due to any of the following reasons:
- Memory pressure
- Server restart
- Plan invalidation, that is, when the underlying objects are changed in some way or a significant amount of data is changed
Stored procedures are the preferred method for plan caching as they provide the most effective mechanism of caching and reusing query plans in SQL Server.
- Visualforce Development Cookbook(Second Edition)
- Mastering Spark for Data Science
- 計算機應用基礎·基礎模塊
- 空間傳感器網絡復雜區域智能監測技術
- 21天學通Visual Basic
- Implementing Oracle API Platform Cloud Service
- JavaScript典型應用與最佳實踐
- INSTANT Drools Starter
- Kubernetes for Developers
- Grome Terrain Modeling with Ogre3D,UDK,and Unity3D
- 工業機器人實操進階手冊
- ZigBee無線通信技術應用開發
- 自適應學習:人工智能時代的教育革命
- 精通ROS機器人編程(原書第2版)
- 基于Quartus Ⅱ的數字系統Verilog HDL設計實例詳解