Subject | Accessing current transaction start timestamp |
---|---|
Author | lelegaifax |
Post date | 2002-11-11T15:37:02Z |
Hi all,
I need to transfer data between two different DBs. Basically what I do
is the following:
a. start a snapshot transaction on the source
b. select 'now' from source_db as START
c. select previous_export_timestamp from source_db
d. for each table in source_db:
d1. start transaction on dest
d2. select * from table where last_modified >= previous_export_timestamp
d3. insert into dest_db:table
d4. commit dest transaction
e. store START as previous_export_timestamp in source_db
and it's almost working, but I have a logical problem: given that
point a) executes at 10:00:00, there is a little delay before I get
the timestamp from b), say 10:00:02. It's just a few seconds, but it's
more than enough to cause "loss" of records: next iteration, the
export will touch only records modified after 10:00:02.
The ideal would be getting the exact timestamp of a). Is it at all
possible? If not, how could I circumvent the problem?
I noticed the existence of RDB$TRANSACTIONS.TIMESTAMP, but the doc
talks about "multi-database" transaction, but I couldn't figure out
how to use that feature.
thanx&bye,
lele.
I need to transfer data between two different DBs. Basically what I do
is the following:
a. start a snapshot transaction on the source
b. select 'now' from source_db as START
c. select previous_export_timestamp from source_db
d. for each table in source_db:
d1. start transaction on dest
d2. select * from table where last_modified >= previous_export_timestamp
d3. insert into dest_db:table
d4. commit dest transaction
e. store START as previous_export_timestamp in source_db
and it's almost working, but I have a logical problem: given that
point a) executes at 10:00:00, there is a little delay before I get
the timestamp from b), say 10:00:02. It's just a few seconds, but it's
more than enough to cause "loss" of records: next iteration, the
export will touch only records modified after 10:00:02.
The ideal would be getting the exact timestamp of a). Is it at all
possible? If not, how could I circumvent the problem?
I noticed the existence of RDB$TRANSACTIONS.TIMESTAMP, but the doc
talks about "multi-database" transaction, but I couldn't figure out
how to use that feature.
thanx&bye,
lele.