Concurrent Data Import and Queries
Transaction T1:
1 2 3 | START TRANSACTION;
COPY test FROM '...';
COMMIT;
|
Transaction T2:
1 2 3 | START TRANSACTION;
SELECT * FROM test;
COMMIT;
|
Scenario 1:
T1 is started but not committed. At the same time, T2 is started. The COPY of T1 and then the SELECT of T2 starts, and both of them succeed. In this case, T2 cannot see the data added by the COPY of T1.
Scenario 2:
- READ COMMITTED level
T1 is started but not committed. At the same time, T2 is started. The COPY of T1 is complete and T1 is committed. In this case, T2 can see the data added by the COPY of T1.
- REPEATABLE READ level
T1 is started but not committed. At the same time, T2 is started. The COPY of T1 is complete and T1 is committed. In this case, T2 cannot see the data added by the COPY of T1.
Last Article: Concurrent UPDATE in the Same Table
Next Article: Data Export
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.