Re: update performance
Posted in 2001
El Mar 13 Feb 2001 16:53, Jonathan Leffler escribi':
>
> I don't fully understand the question, but I'll take a stab at it
> anyway.
>
> UPDATE YourTable SET BoolColumn = 1
> WHERE BoolColumn = 0 AND ...whatever other conditions you need...
> UPDATE YourTable SET BoolColumn = 0
> WHERE BoolColumn = 1 AND ...whatever other (different) conditions...
Yes, this is what I worte. The other condition you put there is a
bool_id IN (....) and in the programing script I build the list of ids.
> If the processing has to scan the table anyway, then updating the
> columns even when not needing to be changed may even be quicker than
> double scanning the table; that depends on the other conditions, any
> indexes, and so on.
That was what I was asking. How would the performance of the update be if I
do it in two updates with 2 conditions or with 2 updates with one condition
each? I mean what consumns more resources, the update of the row, or the
search?
Saludos... ;-)
--
System Administration: It's a dirty job,
but someone told I had to do it.
-----------------------------------------------------------------
Mart'n Marqu's email: martin@math.unl.edu.ar
Santa Fe - Argentina http://math.unl.edu.ar/~martin/
Administrador de sistemas en math.unl.edu.ar
-----------------------------------------------------------------