--setup
create table a(i int);
create table b(i int);
insert into a values (1);
insert into b values (1);
-- case 1
set synchronous_commit = off;
begin read write;
update a set i = i + 1;
commit;
set synchronous_commit = on;
begin read write;
update b set i = i + 1;
commit;
-- case 2
set synchronous_commit = off;
begin read write;
update a set i = i + 1;
commit;
set synchronous_commit = on;
begin read only;
select i from a;
commit;
-- case 3
set synchronous_commit = off;
begin read write;
update a set i = i + 1;
commit;
set synchronous_commit = on;
begin read only;
select i from b;
commit;
-- case 4
set synchronous_commit = off;
begin read write;
update a set i = i + 1;
commit;
set synchronous_commit = on;
begin read only;
commit;
As I understand documentation, case 1 is clear: following synchronous
commit of read write transaction force previous asynchronous commits
to be flushed with it. But what about case 2 (read changes from
asynchronous commit), case 3 (read unrelated data) and case 4 (empty
commit)? Would synchronous commit of read only transaction force
previous asynchronous commits to be flushed to disk?