Home > database >  After MySQL5.5 version, on a single table query, compared to the stored procedure ad-hoc query, the
After MySQL5.5 version, on a single table query, compared to the stored procedure ad-hoc query, the

Time:11-06

As title, to this respect understand explanation about

CodePudding user response:

The advantages of stored procedures include:

- improve the execution efficiency of application, the stored procedure is stored in the database after compiling and execution time can be cached, can improve the speed of execution.
- to reduce the data transmission between application and database, call a stored procedure, you just need to pass parameters, business code already exists in the data;
Stored procedures can implement code reuse, different applications can share the same storage process;
- stored procedures to enhance security, the stored procedure implements the encapsulation of the code, the application data access through stored procedures, without the need for operation between the data table,

CodePudding user response:

refer to the original poster ycczbasd response:
such as topic, to this respect understand explanation about

1, stored procedures, and the SQL query, the scene is different, the former is the multiple SQL package together, mainly do some batch processing, so in addition to avoid the network between the client and database interaction, also make full use of the advantages of server; The latter, more query and return to a small amount of data, realize the ability of complex logic is not the first strong;
2, generally speaking, if a single SQL statement to logic or function, think in terms of procedure to implement,
  • Related