I have a local mysql db and a production mysql db. I make changes locally and use a third party tool to sync the changes to the live server. The tool uses the checksum feature to identify the rows changed. My db structure is simple, one varchar200 field (acts as primary key), and a text field.
The problem is the sync is taking ages since there are thousands of rows. I believe adding a timestamp field will held in getting the checksum quickly for the tool to identify the rows to be synced. this created further more problems, as the timestamp field is different in local and prod servers due to the timezone differences.
I am looking for a useful idea or an alternative to timestamp that gets changed when a row is modified.
PS: I posted a similar question but didn’t get any useful answers. I dont wany to rely on additional tables.
My tip: Don’t use
TIMESTAMPdatatype, useDATETIME. They hold the same kind of data, but difference isTIMESTAMPis updated every time you touch the row, even if you don’t set that column, it will be updated with “now”, including insertions.This means when you use
TIMESTAMP, you can never truly synch the two databases – that column will always be different. If you useDATETIME, you can preserve that column’s data.If you can’t code your applications to update the
DATETIMEcolumn with “now”, simply create a trigger that will do it for you.