P*****f 发帖数: 2272 | 1 【 以下文字转载自 Database 讨论区 】
发信人: Pontiff (树), 信区: Database
标 题: 改写(migrate) stored proc 问题
发信站: BBS 未名空间站 (Sun Feb 1 17:04:12 2009), 转信
现在有一特长控制流程较复杂的MS SQL Server SP 需要改写.
简单来说就是使用标准的JDBC SQL,不使用Stored Procedure.
这样一来,似乎:
1.复杂的控制流程只能在客户端的Java代码实现
2.需要多次(执行SQL/处理结果)的iteration.似乎这样性能会比使用SP降低不少?
any comments are welcomed. thx | c*****t 发帖数: 1879 | 2
其实区别也不是太大。基本上除了个别 function,比如 aggregate, simple
evaluation function 之外,其它在 server 和在 client 上的 code 基本上
差不多。
server procedure 的主要优点就是不需要 transfer data,也不需要 convert
data (endian 问题)。所以 overhead 少很多。
【在 P*****f 的大作中提到】 : 【 以下文字转载自 Database 讨论区 】 : 发信人: Pontiff (树), 信区: Database : 标 题: 改写(migrate) stored proc 问题 : 发信站: BBS 未名空间站 (Sun Feb 1 17:04:12 2009), 转信 : 现在有一特长控制流程较复杂的MS SQL Server SP 需要改写. : 简单来说就是使用标准的JDBC SQL,不使用Stored Procedure. : 这样一来,似乎: : 1.复杂的控制流程只能在客户端的Java代码实现 : 2.需要多次(执行SQL/处理结果)的iteration.似乎这样性能会比使用SP降低不少? : any comments are welcomed. thx
| t*******e 发帖数: 684 | 3 This is a highly debatable issue. It boils down to a very basic question,
where do we place the business logic, in Java code or in stored proc. You
get the benefits of OO programming paradigm by using Java. while DBAs will
surely disagree on that. In doing so, you have to face the challenges of
handling transactions and performance by yourself. I would say let DBAs
write SP if you are not very confident with your skills or business
knowledge. | g*****g 发帖数: 34805 | 4 It all depends on the logic. Personally, I would recommend using SP
for long lasting data processing process, e.g. if you generate a
statement midnight every night based on heavy computation of data,
then SP is preferred. In most other cases, we prefer using an
Object-Relational mapping to simplified development. Also, application
server is easy to cache and scale, doing that on database would be
much more expensive. Most system have bottleneck on database, and you
don't want to impose more burd
【在 t*******e 的大作中提到】 : This is a highly debatable issue. It boils down to a very basic question, : where do we place the business logic, in Java code or in stored proc. You : get the benefits of OO programming paradigm by using Java. while DBAs will : surely disagree on that. In doing so, you have to face the challenges of : handling transactions and performance by yourself. I would say let DBAs : write SP if you are not very confident with your skills or business : knowledge.
| P*****f 发帖数: 2272 | 5 多谢几位的讨论
,
You
will
【在 g*****g 的大作中提到】 : It all depends on the logic. Personally, I would recommend using SP : for long lasting data processing process, e.g. if you generate a : statement midnight every night based on heavy computation of data, : then SP is preferred. In most other cases, we prefer using an : Object-Relational mapping to simplified development. Also, application : server is easy to cache and scale, doing that on database would be : much more expensive. Most system have bottleneck on database, and you : don't want to impose more burd
|
|