Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Updating rows to current values
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 Wed Jun 04 1997 - 00:00:00 CDT