SQL Server execution Plan generation method

Source: Internet
Author: User

Say something about the SQL Server execution plan, first of all I'm not a DBA, and I've done some things about SQL optimization in the last few years, and there's something that I understand, and that's not necessarily true. The difference between the T-SQL statement and the stored procedure passed from the application first is that SQL Server compiles it once, and the stored procedure is compiled, and executes without having to compile again, which is equal to a compilation of multiple executions. The resulting SQL statement, if not a parameterized query, would generate different execution plans, with a chestnut: SELECT * FROM dbo. Employee WHERE ID = 1 and SELECT * FROM dbo. The Employee WHERE ID = 2 generates two execution plans, which means that the condition is also deposited as a statement into the execution plan, and if it is changed to a parameterized query, it will produce only one execution plan, and the next time the access is directly reused, the project has encountered once before, because it is the old project, all of which are splicing SQL in the program. Long time to find clear data is not small query but to execute long, through tracking only to find that the original is the execution Plan storage table is too large, resulting in each access to take the corresponding execution plan, resulting in a waste of performance.

SQL Server execution Plan generation method

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.