If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > When not use triggers, check constraints and stored procedures

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-31-03, 02:17
maayanp maayanp is offline
Registered User
 
Join Date: Jun 2003
Posts: 58
Question When not use triggers, check constraints and stored procedures

Hi,
i would like to hear ideas about this subject.
Thanks!
maayan.
Reply With Quote
  #2 (permalink)  
Old 01-02-04, 08:59
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Maayan,
For Triggers and Check Constraints do not use them if you do not need them. They add to the workload of whatever table and / or columns are involved. Stored procedures are only invoked when called for so they do not add any additional overhead, meaning that there is no indirect processing with Stored procedures. In my opinion, Stored procedures should only be used if they consolidate database logic.

Andy
Reply With Quote
  #3 (permalink)  
Old 01-11-04, 08:46
maayanp maayanp is offline
Registered User
 
Join Date: Jun 2003
Posts: 58
Do you know any literature that talk about disadvantages of those things?
or even give any objective information (response times etc.).
I find only advantages (IBM books).
do you know any performance book/article that talks about those stuff?
i just don't find any...

Thanks,
maayan.
Reply With Quote
  #4 (permalink)  
Old 01-11-04, 11:55
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
Advantages

1. Increases data integrity by centralizing the logic and enforcing the rules in one place, and not relying on one or more application programs to enforce data integrity.

2. There are important performance benefits if the application runs on a remote client and one can eliminate multiple communications to the database.

For example without these features one might do the following:

1. Client submits SQL to server
2. Client gets result back and checks return code
3. Clients submits another SQL to server
4. Client gets result back and checks return code
5. etc.

But the following is much better in terms of performance because there is only one communication between remote client and server:

1. Client invokes stored procedure or single SQL statement
2. DBMS performs multiple SQL statements
3. DBMS sends back return code and parms to client

Disadvantages

1. Using these features usually makes the application less portable to other vendor databases, and to a lesser extent even less portable other DB2 platforms.

2. Makes migration from test to production, etc, a little more complex (especially for stored procedures).

3. It makes the application programmer more dependent on the DBA and requires a high degree of coordination, which can be a problem in some environments, but not all.

4. Performs worse if the logic is redundantly executed by the application and the database (which sometimes happens due to ignorance or poor design).

5. Slightly less flexible than application written SQL code (because only a subset of SQL statements is allowed).
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On