MySQL stored procedures

Source: Internet
Author: User

Their system in a large number of users at the same time registered login, the terminal load is very large, because registration and login, not only to check the user's account, but also need to modify the read user-related Package information table. So I was going to throw this pile of stuff into the stored procedures and functions, so I wrote it, wrote it, The discovery of executing a stored procedure lets MySQL's CPU usage jump from 0.1 to 1.3 (under Linux with the top command), which makes me feel bad, and later looked at my stored procedures with someone who had years of experience in the database. He made the following points:

1. In your stored procedure, there are randomly generated strings, stitching strings, SHA1 encryption string These operations, for MySQL, too much burden

2. Do not use last_insert_id () to get the ID of the previous insert record, this command is inefficient, far less than the Select

3. These, in fact, in the MSSQL and Oracle is not a problem, the two scripting engine is very mature, high efficiency, and MySQL even script is not, so in the stored procedures and functions only crud, do not do anything else, will slow down the efficiency of other words.

MySQL stored procedures

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.