Re: I need to update 30.000 rows - it must be fast.

From: james <jamnshelly_at_yahoo.com>
Date: 7 Mar 2002 02:11:16 -0800
Message-ID: <265334b4.0203070211.40e273b2_at_posting.google.com>


Don't use a trigger is good advice, as the trigger will fire for each row updated which will slow down the original update statement. However, I would question the need for an alarm field at all. At some point you must be selecting where alarm=1. Instead of doing this why not

select * from table_1
where value > max
or value < min

Therefore discarding the need for any update of the alarm column.

"Ashish Mittal" <mittalashish_at_yahoo.com> wrote in message news:<qXph8.11322$Hf7.31854_at_rwcrnsc51.ops.asp.att.net>...
> I would not advise you to use a trigger but build the logic for the alarm
> into the update statement - for example
>
> update table_1 old
> set (value,alarm)=
> (select new.value,case when new.value between min and max then 0 else 1 end
> from new where new.id=old.id)
>
> This should be significantly faster than a trigger.
> "Martin Forsberg" <forsberg_martin_at_hotmail.com> wrote in message
> news:Enmh8.5132$1h4.5892_at_news2.bredband.com...
> > Here is my problem:
> >
> >
> > An application updates a table in Oracle (8.17 on win2000).
> >
> > The application comunicate with Oracle trough ODBC.
> >
> > Every second minute the value is updated for 30.000 diffrent id's.
> >
> > I must check if the VALUE is between MIN AND MAX. If the value is out of
> > range the
> >
> > value must be inserted anyway, but I need to know if the value is out of
> > range.
> >
> >
> > TABLE_1
> > ---------
> > ID
> > MAX
> > MIN
> > VALUE
> > ALARM (Now I use a trigger: ALARM = 1 if VALUE out of range)
> >
> >
> > Is there a smarter solution? I must be very fast.
> >
> >
> >
> > /Martin
> >
> >
> >
> >
Received on Thu Mar 07 2002 - 11:11:16 CET

Original text of this message