Why Stored Procedure and Why not...
2013-03-19 13:41
218 查看
1.
Why Stored Procedure?
a)
Make Database as a Service (DB API), to wrap the brittle database with additional layers in an attempt to find loose coupling. It provides an extra level of abstraction from the underlying database schema, hiding users, hiding details.
b)
Good way to maintain the logic relationship between tables or common businesses (migrated triggers, checked constraints).
c)
Stored Procedure is the only way/Language that will last as long as the data.
d)
Less DB connection hits needed, with better performance at most of the time. (SP cache, pre-compile, Optimizer).
e)
Stored Procedure has better security control.
f)
Stored Procedure has better maintenance in deployed environment. Changing Logic code without restart the services.
g)
Stored procedures can reduce network traffic. It’s appropriate to deal with fetching and looping a great quantity of data.
2.
Why not Stored Procedure?
a)
Need good data model / data architecture/ DBA, and the stored procedure should be written in a maintainable way.
b)
Not easy to change and test
c)
Modularization of Stored Procedure is not very easy
d)
Stored Procedure don't provide much feedback when things go wrong
e)
Stored Procedure is not object-oriented language, it can't pass objects or express objects
f)
Not easy for customer to change Business Logic by themselves
g)
Version Control is not available
h)
With not good extensibility of Computing Capability, at most of the time, multiple applications servers connect to one database server.
i)
If Business Logic or computing consumes much time, the table will be locked all the time.
3.
Performance Test
The drawing below shows the performance comparison between Java and Oracle. Loop is used everywhere in the Oracle and Java, here in the loop, just did something like assignment “Variable = Value_From_Loop”,
we can see the Oracle Loop has better performance than Java.
4. Conclusion
a, we can know that the oracle performance is better than java most of the time while performing the same thing
b, we also know that the Oracle is expensive than Java.
So, make decision by yourself
Why Stored Procedure?
a)
Make Database as a Service (DB API), to wrap the brittle database with additional layers in an attempt to find loose coupling. It provides an extra level of abstraction from the underlying database schema, hiding users, hiding details.
b)
Good way to maintain the logic relationship between tables or common businesses (migrated triggers, checked constraints).
c)
Stored Procedure is the only way/Language that will last as long as the data.
d)
Less DB connection hits needed, with better performance at most of the time. (SP cache, pre-compile, Optimizer).
e)
Stored Procedure has better security control.
f)
Stored Procedure has better maintenance in deployed environment. Changing Logic code without restart the services.
g)
Stored procedures can reduce network traffic. It’s appropriate to deal with fetching and looping a great quantity of data.
2.
Why not Stored Procedure?
a)
Need good data model / data architecture/ DBA, and the stored procedure should be written in a maintainable way.
b)
Not easy to change and test
c)
Modularization of Stored Procedure is not very easy
d)
Stored Procedure don't provide much feedback when things go wrong
e)
Stored Procedure is not object-oriented language, it can't pass objects or express objects
f)
Not easy for customer to change Business Logic by themselves
g)
Version Control is not available
h)
With not good extensibility of Computing Capability, at most of the time, multiple applications servers connect to one database server.
i)
If Business Logic or computing consumes much time, the table will be locked all the time.
3.
Performance Test
The drawing below shows the performance comparison between Java and Oracle. Loop is used everywhere in the Oracle and Java, here in the loop, just did something like assignment “Variable = Value_From_Loop”,
we can see the Oracle Loop has better performance than Java.
4. Conclusion
a, we can know that the oracle performance is better than java most of the time while performing the same thing
b, we also know that the Oracle is expensive than Java.
So, make decision by yourself
相关文章推荐
- [BTS]Could not find stored procedure.
- retrieve the stored procedure or script execte time and cost source
- [转]How to get return values and output values from a stored procedure with EF Core?
- Why Johnny can't clone: Common pitfalls and not so common solutions
- Interview | Why are manhole covers round and not square or rectangular?
- Mysql产生一个随机数时,报Recursive stored functions and triggers are not allowed.
- Caused by: java.lang.ClassNotFoundException: javax.persistence.NamedStoredProcedureQuery
- Mysql:User does not have access to metadata required to determine stored procedure parameter types.
- Why ASMLIB and why not? <转载…
- ORDER, SUM and Stored Procedure in MySQL
- InvalidArgumentError : Shape in shape_and_slice spec [,] does not match the shape stored in checkpoi
- Do not include the "@" character when supplying stored procedure parameter names to a SQL Server database
- Why ASMLIB and why not?
- The remote procedure call failed and did not execute的解决办法
- SQL Stored Procedure and Function
- 安装SharePoint2010出现“Could not find stored procedure ‘sp_dboption’.”的解决方法
- Rplication error: Could not find stored procedure 'dbo.sp_MSins_dboTablename'解决方法.
- Why Not Mix Signed and Unsigned Values in C/C++?
- The remote procedure call failed and did not execute的解决办法