Hi Vlad,

Maybe you should go first to the end of may email (quite long – sorry please be 
patient)
I suppose that i misunderstand names and meaining.

>>   This is the commit number of currently used snapshot, if present.
>> Non-RC transactions create snapshot at own start and SNAPSHOT_CN is the CN 
>> of that snapshot.
>> RCRC transactions create snapshot when user query execution starts.
>> Old style RC transactions doesn't create snapshots.

Maybe i still do not know what does „snapshot” in name SNAPSHOT_CN mean?
Is this CN of last commited snapshot transaction (excluding any read commited) 
or what?

If this is last committed snapshot transaction and block progress until next 
snapshot is commited then it is not so usefull, 
Because if read commited transaction change something i will not see changes in 
delta until new snapshot transaction will be commited.
But maybe my understand of SNAPSHOT_CN is wrong?

If my understanding is ok – then i can fix this by starting empty snapshot 
transaction and commit it or do any select in RC transaction before got delta.
Then i can run my interesting query with delta fetch. But maybe GLOBAL_CN is 
better here and fix all my maining issues.

>>   Hmm... probably you want here
>>   SELECT * FROM NAMES
 >>  WHERE RDB$GET_TRANSACTION_CN(RDB$RECORD_VERSION) >= :lastCN

If this call to RDB$GET_TRANSACTION_CN will be efficient as separate request 
per record then yes
If not then virtual table will be much better

> And we can add to the WHERE clause „AND RCN.TR_ID>=last_retrived_OAT”
>   Hmm... not sure i got this idea

Sorry wrong alias AND N.TR_ID>= last_retrived_OAT
This is only for using index scan and read only portion of table instead of 
natural scan throught whole table.

> With only SNAPSHOT_CN we have same problem as with OAT.
>>   Please, explain

It may not be necessary if the answer to the first question about what 
SNAPSHOT_CN is like is that I misunderstood its meaning.

But when i read my above email i think that,
first will be good to see sample about value of GLOBAL_CN (GCN) and SNAPSHOT_CN 
(SCN) and its real maining
e.g. (maybe you can explain this shortly without answer to values of GCN, SCN 
here)

1. dabase restored
2. First connection established (GCN=?, SCN=?)
3. Transaction 1 RC start
4. (GCN=?, SCN=?)
5. Transaction 2 RC start 
6. (GCN=?, SCN=?)
7. Transaction 3 Snapshot start 
8. (GCN=?, SCN=?)
9. Transaction 1 select
10. (GCN=?, SCN=?)
11. Transaction 2 select
12. (GCN=?, SCN=?)
13. Transaction 3 select
14. (GCN=?, SCN=?)
15.  Transaction 1 update
16. (GCN=?, SCN=?)
17. Transaction 2 update
18. (GCN=?, SCN=?)
19. Transaction 3 update
20. (GCN=?, SCN=?)
21. Transaction 2 is commited 
22. (GCN=?, SCN=?)
23. Transaction 3 is commited
24. (GCN=?, SCN=?)
25. Transaction 4 snapshot start
26. (GCN=?, SCN=?)
27. Transaction 4 rollback!
28. (GCN=?, SCN=?)
29. Transaction 1 commit
30. (GCN=?, SCN=?)


Regards,
Karol Bieniaszewski
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to