Multiversion Read consistency
Rajeshwaran, Jeyabal, May 17, 2016 - 12:33 pm UTC
So I have a resultset I will call this ResultSetA - Lets say at time T1 we have this resultset 'ResultSetA'
I iterate this resultset and for each row in the resultset I execute a UPDATE statment. - Let say at time T2 you do this changes.
The issue is that this UPDATE statment is making the results of ResultSetA change.This is because I am updating a table that is in ResultSetA- Updates statements will be against your Tables/views not against the resultsets, result sets are predefined, can't updated.
I wish ResultSetA would stay static and not change - Yes the result set will stay static as of T1.( This is what read consistency is all about)
but this does not seem to be the case. - Why so any examples or test cases?
Here is an example of how the result sets available (point in time queries) even after the records got deleted and committed.
demo@ORA12C> variable x refcursor
demo@ORA12C> begin open :x for select * from dept; end;
2 /
PL/SQL procedure successfully completed.
demo@ORA12C>
demo@ORA12C> delete from dept;
4 rows deleted.
demo@ORA12C> commit;
Commit complete.
demo@ORA12C> select * from dept;
no rows selected
demo@ORA12C> print x
DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON
4 rows selected.
demo@ORA12C>
Resultset prefetch size
Paul Borgen, May 19, 2016 - 12:59 pm UTC
Thank You for your help. I think the reason your example are working is that that amount of data in the resultset is small and does not exceed the resultset "prefetch" size. I am going to take your example and run a test to know for sure. For what I am doing I have 30,000 rows and I am thinking that because this exceeds my prefetch size I am seeing this issue.
Thanks for your help. If there are any other ideas please let me know.
May 20, 2016 - 2:51 am UTC
prefetch should not make any difference here.
The only thing that will make a difference is if your client app resets the cursor in some way (eg close/re-open). Because opening the cursor again, establishes a new starting time for the fetch.
Hopefully the software layer you are using is not doing that automatically "under the covers"