database schema eligible for delta synchronization

Posted by WilliamLou on Stack Overflow See other posts from Stack Overflow or by WilliamLou
Published on 2011-01-13T20:03:51Z Indexed on 2011/01/15 9:53 UTC
Read the original article Hit count: 295

Filed under:
|
|
|
|

it's a question for discussion only. Right now, I need to re-design a mysql database table. Basically, this table contains all the contract records I synchronized from another database. The contract record can be modified, deleted or users can add new contract records via GUI interface. At this stage, the table structure is exactly the same as the Contract info (column: serial number, expiry date etc.). In that case, I can only synchronize the whole table (delete all old records, replace with new ones). If I want to delta(only synchronize with modified, new, deleted records) synchronize the table, how should I change the database schema?

here is the method I come up with, but I need your suggestions because I think it's a common scenario in database applications. 1)introduce a sequence number concept/column: for each sequence, mark the new added records, modified records, deleted records with this sequence number. By recording the last synchronized sequence number, only pass those records with higher sequence number;

2) because deleted contracts can be added back, and the original table has primary key constraints, should I create another table for those deleted records? or add a flag column to indicate if this contract has been deleted?

I hope I explain my question clearly. Anyway, if you know any articles or your own suggestions about this, please let me know. Thanks!

© Stack Overflow or respective owner

Related posts about mysql

Related posts about database