The theory will make much more sense after you see it in action. Jared
"Magaliff, Bill" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 09/06/2002 07:23 AM Please respond to ORACLE-L To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> cc: Subject: RE: foreign key indexes and parent-table locking I agree that that's the best way to see what actually happens, and I will do that but I like to understand the theory, too . . . -bill -----Original Message----- Sent: Thursday, September 05, 2002 5:40 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Importance: High Bill, Rather than try to understand that explanation, you may find it more educational to create a pair of tables with a parent/child relationship via foreign key. Put some data in the tables, then do updates and deletes both with and without FK indexes. Examine dba_locks while doing so and observe the lock modes. This will be much easier to understand than the 'documentation' Jared "Magaliff, Bill" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 09/05/2002 02:23 PM Please respond to ORACLE-L To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]> cc: Subject: foreign key indexes and parent-table locking Hi, I'm trying to understand the whole issue of foreign key indexes and locking. Found a note on metalink (11828.1) that seems to explain it, but either it's not clear or I'm missing something. "Why then, does an index on the foreign key mean that the shared lock on the parent table is not required? "When a row in the child table is inserted, deleted or has its foreign key updated, the corresponding index entry/entries is/are also locked. When an application attempts to delete or update the primary key of a parent row, it reads the FIRST corresponding entry in the child's foreign key index (uncommitted or otherwise) and, if locked, waits for that lock to be released." So far so good . . . this next piece, too, seems to make sense: "If the modified child row is NOT the first occurrence of the foreign key in the index then the parent modification must be prevented anyway, regardless of the outcome of uncommitted transactions on other child rows with this key." But now here's the part that leaves me hanging . . . "Hence the error can be flagged immediately and so the transaction is not forced to wait. This mechanism ensures the minimum reads and wait times to maintain data consistency. " Can anyone help by either translating this last part or rephrasing it? Or explaining the issue differnetly? Thanks bill -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Magaliff, Bill INET: [EMAIL PROTECTED] Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Magaliff, Bill INET: [EMAIL PROTECTED] Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: [EMAIL PROTECTED] Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).