Re: 10g: parallel DML trigger race conditions?
From: joel garry <joel-garry_at_home.com>
Date: Wed, 16 Feb 2011 09:19:55 -0800 (PST)
Message-ID: <7fe7f2b7-eccc-46a2-8a7a-80c3ef3ed795_at_f36g2000pri.googlegroups.com>
On Feb 16, 5:08 am, Randolf Geist <mah..._at_web.de> wrote:
> On Feb 16, 7:34 am, Frank Bergemann <FBergem..._at_web.de> wrote:
>
>
>
> > Hi,
>
> > are triggers executed in parallel for parallel DML?
> > What happens, if the same record is updated _twice_ in a bulk update?
> > Something like this:
> > forall i reloads.first..reloads.last
> > update account set money = money + reloads(i).amount where
> > account.id = reloads.acct_id;
>
> > Can it happen, that two "trigger before insert or update on account
> > for each row" are executing in parallel for the same record?
> > - if acct_id = X is there multiple times in table reloads.
>
> > So they will find the same :old conditions.
> > Or does oracle take care for sequential execution of trigger for same
> > record?
>
> > - thanks!
>
> > rgds,
> > Frank
>
> Not directly answering your question but FORALL is not performing
> parallel DML, it is merely doing a bulk operation that minimizes the
> overhead of single row operations. I'm not aware of it being able to
> run in parallel DML mode.
Date: Wed, 16 Feb 2011 09:19:55 -0800 (PST)
Message-ID: <7fe7f2b7-eccc-46a2-8a7a-80c3ef3ed795_at_f36g2000pri.googlegroups.com>
On Feb 16, 5:08 am, Randolf Geist <mah..._at_web.de> wrote:
> On Feb 16, 7:34 am, Frank Bergemann <FBergem..._at_web.de> wrote:
>
>
>
> > Hi,
>
> > are triggers executed in parallel for parallel DML?
> > What happens, if the same record is updated _twice_ in a bulk update?
> > Something like this:
> > forall i reloads.first..reloads.last
> > update account set money = money + reloads(i).amount where
> > account.id = reloads.acct_id;
>
> > Can it happen, that two "trigger before insert or update on account
> > for each row" are executing in parallel for the same record?
> > - if acct_id = X is there multiple times in table reloads.
>
> > So they will find the same :old conditions.
> > Or does oracle take care for sequential execution of trigger for same
> > record?
>
> > - thanks!
>
> > rgds,
> > Frank
>
> Not directly answering your question but FORALL is not performing
> parallel DML, it is merely doing a bulk operation that minimizes the
> overhead of single row operations. I'm not aware of it being able to
> run in parallel DML mode.
And Tom of course addresses that in detail, too: http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:17483288166654
He also shows in passing that a loop is simply a goto :-)
jg
-- _at_home.com is bogus. "I reckon another 5 years and Tb dbs are gonna be as common as tea in a pot. We better be ready... " - Noons, Nov, 2004Received on Wed Feb 16 2011 - 11:19:55 CST