in reply to mirroring mySQL database
You can cook up a completely general solution for this, but it takes application and database changes. Put most simply, you need to maintain a last-modified-time column in any table that you want to mirror. Any code that updates or inserts the table needs to update that column with a time of sufficient resolution for your application (usually down to seconds).
With that data available, you can retrieve all rows that are newer than the last time you looked at the table (presumably you're maintaining the last-lookup time in a separate table -- or even a flat file). The only trick is if that if the tables allow row deletion, you have to store at least the primary key of every deleted row in a counterpart table. You can also try to do "soft deletes", where you only mark a row as ready to be deleted, and don't actually delete it until some point in the future. But that gets even more complicated.
One client I work for has a system like this in place for about a hundred tables in dozens of applications. It takes work, but it's effective, and generalizes to all rdbms platforms.
HTH
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: mirroring mySQL database
by belg4mit (Prior) on Dec 06, 2001 at 09:21 UTC |