postgresql - Script to track Database change -
i need track changes of data in postgresql database. there option in database or script view data , dml well.
sorry - have no clue. have different suggestions:
log /all/ queries , grep involving update, delete, insert, alter table etc. caveats: may cause performance problems if there lots of queries , log on same raid data and/or wal. not sure if it's easy make regexp 100% catch modifying statements. may difficult catch rollbacks etc. log everything, add configuration file:
log_min_duration_statement = 0
. have other log_* configuration variables sane well.the rules/trigger approach (as hinted other user) - believe involves writing rules each , every table - it's of course doable (and should possible create rules through external script if have lot of tables). may bit how slony works - slony trigger-based replication system, should possible use catch changes in db.
all changes database ends in wal-file, maybe it's theoretically possible extract out wal, suspect that's not practical unless you're skilled postgres hacker ... , if you're skilled postgres hacker, wouldn't ask question in first place ;-) (eventually, wals may used see rate of changes in data , spot times of day when there more updates otherwise etc. may used replication , roll-forward binary backup)
Comments
Post a Comment