Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Updating rows to current values
Chrys,
I am working with a test database right now and there are only about 200 rows currently in the table, so it's so fast I can't really tell whether there's any difference or not. I'm wondering about when it gets into production and there are thousands of rows being affected by this update.
Ken Denny
kdenny_at_interpath.com
BTW, just curious. What does the "ie" in your domain name mean? Is that Ireland?
Chrysalis wrote:
>
> Since you did it both ways, surely you should be answering this question
> yourself!
>
> Did you notice a difference? If you did, it was a useful optimisation.
> If you didn't, it wasn't necessary.
>
> Chrysalis.
>
> Ken Denny wrote:
> >
> > I was writing a package and in it I wanted to update several rows in the
> > database. Let's say the table is called tab1 and I want to update a
> > column called status. I had:
> > UPDATE tab1 SET status = 'A' WHERE <condition>;
> > In this case there may be thousands of rows which satisfy the condition,
> > and it is possible that a large portion of them may already have 'A' in
> > the status column. I figured that it may perform better if I only update
> > those rows which need it so I changed the statement to:
> > UPDATE tab1 SET status = 'A' WHERE <condition> AND status != 'A';
> > My question is, was this necessary, or would it have performed equally
> > well with or without the "AND status != 'A'" clause?
> >
> > Thanks in advance
> > Ken Denny
> > kdenny_at_interpath.com
Received on Thu Jun 05 1997 - 00:00:00 CDT