MySQL Stored procedure analysis

Source: Internet
Author: User

To figure out why MySQL's stored procedures are efficient, we need to understand what the MySQL execution process is, and when the SQL statement is entered, MySQL checks the syntax of the SQL statement before compiling it, then executes it and returns the result. As shown in the following:


Normal SQL statements are parsed and compiled by the MySQL engine, and stored procedures require parsing and compiling at the first run, but the subsequent call to the stored procedure eliminates the need for parsing and compiling, which greatly improves the efficiency of SQL execution.  What is a stored procedure? stored procedures are precompiled collections of SQL statements and control statements that are stored as a single name and processed as a unit.  Advantages of stored procedures:1 enhanced the functionality and flexibility of SQL statements2 achieve faster execution speed3 Reduced network traffic create a stored procedureCREATE user PROCEDURE stored procedure name (parameter 1, parameter 2,...)Process Body There are three types of parameters: in Out INOUT Process Body: 1 The process body consists of arbitrary and legitimate SQL statements                        

MySQL Stored procedure analysis

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.