The best way of update records in MySQL from XML feed
I am thinking about the best way, how to update my records in table (MySQL) from XML feed. I have database and this database contains the daily offers from several sales por开发者_开发知识库tals. So now - about midnight I am deleting all records from my table (because I think is better delete everything from table than comparing currently data with inserted) and with using script (run of CRON) I am downloading new offers from portal (by their XML feeds). This way have one disadvantage -- the time interval among deleting old and inserting new records is ca 5 minutes -- and through this 5 minutes is table empty.
And I would like to ask you, if you could help me with some better way, how updating records in my table using better way...
Thanks a lot for your time!
I would import the new xml feeds into a temporary table, keeping the old table active; and then when all imports are successful, you can simply drop the original table and rename the new to be the original. This should result in less downtime, but more importantly it will give you the ability to abort the switch in the event the new import of XML fails on a given night.
hope that helps.
精彩评论