On Monday 06 October 2008, toly wrote:
I can answer about Sybase: update is
delete/insert, and optimizer will do
it more effectively the executing 2 different transaction.
Hi Daniel,
i think that doing a update is faster then doing two queries. The core need to
construct another SQL string, the DB need to be parse this and so on.. It
probably depend on the DB type, and exact configuration, but i doubt the
difference will be that relevant. Doing a delete and insert in two steps is
also different from the update that you have one small interval of
inconsisteny where the old record has been deleted, and the new one not yet
created (if you don't use transactions).
Aparently also for postgres an UPDATE is also the same as and DELETE/INSERT.
[1], which means its faster here too.
ok. I was looking to use prepare statements or a stored procedure.
However, seems some db servers are doing it in this way, so probably
there are internal optimizations.
Thanks,
Daniel