Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Limits on referential integrity

Re: Limits on referential integrity

From: orantdba <orantdba_at_netscape.net>
Date: Tue, 22 Jan 2002 07:51:46 -0800
Message-ID: <F001.003F6FF8.20020122061020@fatcity.com>

Hi Dennis,

Agreed this was not the developers fault,  it was the DBA's!  I don't blame

this on RI being handled by constraints, but on a DBA that doesn't understand

the consequences, the resulting table level lock could have also been a problem :-).  
BTW, if RI had been handled via the application they would have had the same

problem.

John

dgoulet_at_vicr.com wrote:

  John,    I have only seen one situation where referential integrity has caused aproblem that the developer could not prevent.  That case involved a foreign keywith the 'on delete cascade' option turned on and the key column in the childtable was NOT indexed.  OH, BTW the child table was well lets just say VERYlarge (2 billion rows).Dick Goulet____________________Reply Separator____________________Subject:    Re: Limits on referential integrityAuthor: orantdba <orantdba_at_netscape.net>Date:       1/22/2002 5:40 AM--------------020102080806060304030001Content-Type: text/plain; charset=us-ascii; format=flowedContent-Transfer-Encoding: 7bitHi Dennis,Just my opinion but I tried to follow these rules as a DBA.  1. If the business rule can be implemented with pk, fk, unique or check constraint
s I do it as such2. If the business rule can be implemented as a trigger I code it as a trigger3. If none of the above, I implement as a stored procedure and try to insure that every developer uses this procedure.Occasionally I have heard the "performance discussion" in regards to constraints. In 5 years of consulting I have never had constraints be THE problem. But if I was a developer that had written some of the awful SQL I have seen, I might have tried [:-)] . Constraints do put a premium on error checking by the application on inserts/updates.Hope this helps,JohnDWILLIAMS_at_LIFETOUCH.COM wrote:   

    Jared - I wasn't clear, but then again it is Monday. I have a team ofinexperienced developers starting a big, new Java application. They have agood, experienced data model consultant helping them create the data model.They are eager to include referential integrity. So eager it has me a littleworried. My question: "Is there too much of a good thing?". In Oracle 7,sometimes sites would remove RI to ensure good performance (we are startingthis project on Oracle9i). Has anyone encountered problems with too manyconstraints? Any guidelines you use with developers? Thanks.Dennis WilliamsDBALifetouch, Inc.dwilliams_at_lifetouch.com-----Original Message-----Sent: Monday, January 21, 2002 4:16 PMTo: Multiple recipients of list ORACLE-LI would be you lunch that what they are implementing in theircode is not actually  RI. They may be implementing code to ensure things get inserted in the right order, and that child rowshave a parent.This is a very weak form of RI. Oracle is very good at implementingRI, and it is not dependent on an application. RI in the databaseis the route to choose unless there is some good reason not to.RI in the database will prevent orphaned data created through updates, deletes or even ( gasp! ) bugs in the app.Programmers tend to dislike RI in the database because itforces them to maintain data integrity in a transaction. This isnot a bad thing, it just forces them to have a good understandingof their transactions.Point out to them that it is less code to write as well. :)JaredDENNIS WILLIAMS <DWILLIAMS_at_LIFETOUCH.COM>Sent by: <a class="moz-txt-link-abbreviated" href="mailto: ! !
root_at_fatcity.com">root_at_fatcity.com01/21/02 01:35 PMPlease respond to ORACLE-L To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc: Subject: Limits on referential integrityHow much referential integrity should be implemented in Oracle? We arestarting a large new Java project. Our current applications keep theirreferential integrity inside their own dictionary, so I haven't had to dealmuch with referential integrity recently. Can there be too much of a goodthing? What guidelines do you tend to use? At this point the developers aredesigning the data model so they are busily linking all the little boxes. Myattitude at this point is "implement what you've got and if there areperformance problems we'll deal with them when they arise". Can anyone giveme a better motto? <b ! !
r>Thanks.Dennis WilliamsDBALifetouch, Inc.dwilliams_at_lifetouch.com     

    --------------020102080806060304030001Content-Type: multipart/related; boundary="------------InterScan_NT_MIME_Boundary"--------------InterScan_NT_MIME_BoundaryContent-Type: multipart/alternative;boundary="------------020102080806060304030001" boundary="------------070606010707000609020708"--------------070606010707000609020708Content-Type: text/html; charset=us-asciiContent-Transfer-Encoding: 7bit<html><head></head><body><pre wrap="">Hi Dennis,Just my opinion but I tried to follow these rules as a DBA. 1. If the business rule can be implemented with pk, fk, unique or check constraints I do it as such2. If the business rule can be implemented as a trigger I code it as a trigger3. If none of the above, I implement as a stored procedure and try to insure that every developer uses this procedure.! !
Occasionally I have heard the "performance discussion" in regards to constraints. In 5 years of consulting I have never had constraints be THE problem. But if I was a developer that had written some of the awful SQL I have seen, I might have tried <imgsrc=""chrome://editor/content/images/smile_n.gif" alt=":-)" class="moz-txt-smily"height="19" width="19" align="Center">. Constraints do put a premium on error checking by the application on inserts/updates.Hope this helps,John</pre><br><br>DWILLIAMS_at_LIFETOUCH.COM wrote:<br><blockquote type="cite" cite="mid:md5%3 A64756D6D79206D657373616765206964"> <pre wrap="">Jared - I wasn't clear, but then again it is Monday. I have ateam of<br>inexperienced developers starting a big, new Java application. Theyhave a<br>good, experienced data model consultant helping them create the datamodel.<br>They are eager to include referential integrity. So eager it has me alittle<br>worried. My question: "Is there too much of a good thing?". In Oracle7,<br>sometimes sites would remove RI to ensure good performance (we arestarting<br>this project on Oracle9i). Has anyone encountered problems with toomany<br>constraints? Any guidelines you use with developers? Thanks.<br>DennisWilliams<br>DBA<br>Lifetouch, Inc.<br><a class="moz-txt-link-abbreviated"href=""mailto:dwilliams_at_lifetouch.com"><a class="moz-txt-link-abbrev ! !
iated" href="mailto:dwilliams_at_lifetouch.com">dwilliams_at_lifetouch.com</a><br><br><br>-----Original Message-----<br>Sent: Monday, January 21, 2002 4:16 PM<br>To:Multiple recipients of list ORACLE-L<br><br><br>I would be you lunch that whatthey are implementing in their<br>code is not actually RI. They may be implementing code to <br>ensure things get inserted in the rightorder, and that child rows<br>have a parent.<br><br>This is a very weak form ofRI. Oracle is very good at implementing<br>RI, and it is not dependent on anapplication. RI in the database<br>is the route to choose unless there is somegood reason not to.<br><br>RI in the database will prevent orphaned data createdthrough <br>updates, deletes or even ( gasp! ) bugs in theapp.<br><br>Programmers tend to dislike RI in the database because it<b r>forcesthem to maintain data integrity in a transaction. This is<br>not a bad thing,it just forces them to have a good understanding<br>of theirtransactions.<br><br>Point out to them that it is less code to write as well.:)<br><br>Jared<br><br><br><br><br><br><br><br>DENNIS WILLIAMS <DWILLIAMS_at_LIFETOUCH.COM><br>Sent by: <a class="moz-txt-link-abbreviated" href="mailto:r!o !!ot_at_fatcity.com">root_at_fatcity.com</a
><br>01/21/02 01:35 PM<br>Please respond toORACLE-L<br><br> <br> To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com><br> cc: <br> Subject: Limits on referential integrity<br><br><br>Howmuch referential integrity should be implemented in Oracle? We are<br>starting alarge new Java project. Our current applications keep their<br>referentialintegrity inside their own dictionary, so I haven't had to <br>deal<br>much withreferential integrity recently. Can there be too much of a good<br>thing? Whatguidelines do you tend to use? At this point the developers <br>are<br>design

ingthe data model so they are busily linking all the little boxes.<br>My<br>attitude at this point is "implement what you've got and if thereare<br>performance problems we'll deal with them when they arise". Can anyone<br>give<br>me a better motto? <br>Thanks.<br>Dennis Williams<br>DBA<br>Lifetouch, Inc.<br>dwilliams_at_lifetouch.com<br><br></pre>  </blockquote>  <br>  </body>  </html>--------------070606010707000609020708----------------020102080806060304030001--
    
    
    
    
Received on Tue Jan 22 2002 - 09:51:46 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US