Home > database >  Use stored procedures compared with the speed of SQL syntax (online waiting)
Use stored procedures compared with the speed of SQL syntax (online waiting)

Time:10-03

The period of SQL syntax, combination of the same query into a stored procedure, the retrieval speed slower than directly using SQL query speed a lot.
Which experts know what reason is this?

CodePudding user response:

Stored procedure fast, of course!
If it is slow, the algorithm has a problem or other reasons!

CodePudding user response:

Can actually run as a result, SQL syntax is fast. The stored procedure takes 5 seconds, and SQL syntax 1 seconds OK
Only in the syntax to SUM function, and the rest is to take multiple tables of data
And there is no other complex calculation

CodePudding user response:

To post your SQL
And the definition of your stored procedure statement

Database, involves the index table

CodePudding user response:

Is it because you're too simple SQL

Write directly than a code with process short, ha ha

CodePudding user response:

Stored procedure is applicable to the more complex algorithms, if only to retrieve or insert, update records, I feel or use SQL statements directly is more convenient,

CodePudding user response:

Ha ha ha, of course, on the whole, is a SQL statement is slow, but if more simple query, SQL indeed quicker, execute the stored procedure background work obviously than direct write statement in SQL/plus much more!!

CodePudding user response:

Simple, fast, of course, is the direct SQL statement

SQL statements directly, it is finished in query server, the result has passed through the network

And storage process, want to call first compiled stored procedure beforehand, executing SQL statements, then transfer the results to

If direct SUM statements, or use the SQL statement
If there is a complex operations, involving the integrity of the data table, the stored procedure is better

CodePudding user response:

Unknown LZ talking about

CodePudding user response:

Wait for people to answer.
  • Related