- 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.
- 自動控制工程設計入門
- 計算機圖形學
- Python Artificial Intelligence Projects for Beginners
- R Machine Learning By Example
- VMware Performance and Capacity Management(Second Edition)
- Supervised Machine Learning with Python
- Apache Superset Quick Start Guide
- Citrix? XenDesktop? 7 Cookbook
- 計算機組成與操作系統
- AMK伺服控制系統原理及應用
- 3ds Max造型表現藝術
- 電動汽車驅動與控制技術
- Learning iOS 8 for Enterprise
- PowerPoint 2003中文演示文稿5日通
- 大話數據科學:大數據與機器學習實戰(基于R語言)