From: Rajeev Prasad Date: April 7 2013 3:49am Subject: Re: update a row only if any column has changed, in a very large table List-Archive: Message-Id: <> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable thx all, the source data is in text file.=0A=0A=0A=0A=0A----- Original Mess= age -----=0AFrom: "hsv@stripped" =0ATo: mysql list =0ACc: =0ASent: Saturday, April 6, 2013 8:02 PM=0ASubject: Re:= update a row only if any column has changed, in a very large table=0A=0A>= >>> 2013/04/06 13:56 -0700, Rajeev Prasad >>>>=0AI have a table with around= 2,000,000 records (15 columns). I have to sync this from an outside source= once every day. not all records are changed/removed /new-added everyday. s= o what is the best way to update only those which have changed/added/or del= eted?=0A=0Ai can use update_or_create but that will update (re-write the ro= w) even if nothing has changed in the row/record. wont that be an overhead?= how can i escape that? what would be the fastest and least resources consu= ming way to do this table update?=0A=0AI also have another table with 500,0= 00 rows and i wish to implement the same solution to that too.=0A=0AI earli= er posted this on DBIx list, as i thought i could use DBIx tools to manage = this. but based on response, it seems that MySQL tools would be more helpfu= l in doing it in most efficent way. Plz. advice how can i address this.=0A= =0AI also considered to delete and simply recreate the table each day..... = but changes/add and delete are not too many (may be a few hundreds.. max)= =0A<<<<<<<<=0ASounds like a case for replication (look it up: n/5.5/en/replication-formats.html). There is statement-replication, and row= -replication. The former replicates all operations on the database, in the = form wherin they were made. False changes (changing a field to its former v= alue), too, are recorded. The latter records only those changes to a table = that are real changes. (In MySQL statement-replication is of earlier implem= entation.)=0A=0AAfter changes are recorded, they are passed from the master= --the wellspring of the changes-- to the slave --the taker of them.=0A=0AT= hese are not tools, as such: replication is something implemented in the da= tabase-management system. If both your databases are in MySQL you can get h= elp here.=0A=0A=0A-- =0AMySQL General Mailing List=0AFor list archives: htt= p:// unsubscribe:=A0 =A0 ysql