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