I have a data transfer tool that transfers information from one database to another. Every hour it will issue an UPDATE on all the rows in a table. I already have an INSERT trigger to dump the data from that one table into a number of other tables. I added an UPDATE trigger to edit the other tables, but it’s making the extra processing is making the entire UPDATE process run slowly.
I’d like to wrap the body of the UPDATE trigger in an IF statement that compares the old and new rows, and skips processing if nothing has changed. Is it possible to compare an entire row against another, like this?
IF new = old THEN ...
Or is there no other option than to check each column individually?
If speed is the issue here, I would either save a timestamp of when it was last edited or a checksum.
Using the latter approach, if you have a table with three rows
A,BandC, I would modify this scheme to also include a new row,cksum.Whenever you insert something, you would in the
cksuminsert a value generated using a fast hashing algorithm, for instance MD5. This checksum could be something likeThis way, whenever having to insert something, you would only have to compare with the
cksumfield.