Search Postgresql Archives

modification time & transaction synchronisation problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.
I need to export data from the database to external file. The difficulty is that only data modified or added since previous export should be written to the file.
I consider adding "modification_time" timestamp field to all the tables that should be exported. Then I can set this field to now() within ON UPDATE OR INSERT trigger.
During export I can select modified data with 'WHERE modification_time > last_export_time' clause.

It seems to be the solution but...
What if the concurrent (and not yet committed) transaction modified some data before export transaction begins? These modifications would not be visible to export transaction and modified data would not be included to export file. Also it won't be included to the next export because it's modification time is less than current export start time (the new value of last_export_time).

Thus some data could be lost from export files sequence. And that is not good at all.

I will appreciate any suggestions on how to solve this problem. I.e. how can I (within the export transaction) select all the data that was updated since the last export?

Thanks.
Eugene.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux