Re: SQL Update question
- From: "Steve Gerrard" <mynamehere@xxxxxxxxxxx>
- Date: Thu, 10 May 2007 20:34:24 -0700
"Robert Morley" <rmorley@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:Ok6q7S3kHHA.4188@xxxxxxxxxxxxxxxxxxxxxxx
Generally, if ONE thing needs updated, you just update everything, even if
the values are the same. It's just easier this way because you've only got
one UPDATE SQL statement.
This only applies if you're using UPDATE statements. If you're using a
rs!Field.Value = MyValue, then the one-update thing isn't really an issue, as
DAO or ADO will figure out what's appropriate. In this case, it would
probably be more desirable to not update if the field hasn't changed.
Two reasons NOT to update everything are 1) if there's some kind of
replication going on (particularly column-level replication) in the database,
in which case updating a field, even if it's to the same value, may trigger
unnecessary replication of the data and potentially cause conflicts; and 2) if
you're using a database that supports triggers, updating a field unnecessarily
may cause the trigger to fire. This may be undesirable if, say, you're
tracking the time a specific field last changed and the field hasn't actually
changed.
Lately, I have not only taken to updating only the fields that change, but to
comparing the values first, so that even if they are edited, it doesn't update
them if the new value is the same as the old value.
It means more cursors on the database server end, since there are lots of
different update statements hitting it, instead of the same ones all the time.
But in my case, the server is bored and idle most of the time anyway.
I am now logging every change in every field, so it is worth it to me to avoid
unnecessary updating whenever possible.
.
- References:
- SQL Update question
- From: Darhl Thomason
- Re: SQL Update question
- From: MikeD
- Re: SQL Update question
- From: Robert Morley
- SQL Update question
- Prev by Date: Re: SQL Update question
- Next by Date: Re: Right syntax for EXPRESSION
- Previous by thread: Re: SQL Update question
- Next by thread: Re: SQL Update question
- Index(es):
Relevant Pages
|