Wednesday, April 19, 2006
Monday, April 17, 2006
Stored Procedures or Java?
I found this thread on Artima forums discussing where logic should reside in database apps: stored procedures or java.
We've had this discussion many times at my place of work & I am currently on a project with zero stored procedures. But stored procedures are used heavily in our still strong legacy app & they helped us achieve acceptable performance at the time. One of the issues I remember from working on the legacy app was the problem that stored procedures caused with caching. With stored procedures updating rows w/o the knowledge of the application server, it makes cache consistency a real problem. We worked out a couple of ways to address this: 1) callbacks to the application server and 2) bringing cache into java vm in oracle database. We wrote some "stored procedures" in java as well.
I am in the camp that stored procedures have their place in batch processes that need the performance boost. But you need to plan for them up front & design your architecture accordingly.
We've had this discussion many times at my place of work & I am currently on a project with zero stored procedures. But stored procedures are used heavily in our still strong legacy app & they helped us achieve acceptable performance at the time. One of the issues I remember from working on the legacy app was the problem that stored procedures caused with caching. With stored procedures updating rows w/o the knowledge of the application server, it makes cache consistency a real problem. We worked out a couple of ways to address this: 1) callbacks to the application server and 2) bringing cache into java vm in oracle database. We wrote some "stored procedures" in java as well.
I am in the camp that stored procedures have their place in batch processes that need the performance boost. But you need to plan for them up front & design your architecture accordingly.