> WAL does this already.  You just need to BEGIN a transaction when you
want it to BEGIN and COMMIT or ROLLBACK when you are done with it.

I was under the apparently mistaken impression that starting any
transaction would block writes, even in WAL mode.

Just to be clear, this would work:

On multiple concurrent reader threads/connections:

BEGIN;
SELECT col FROM table;
SELECT col FROM table;
ROLLBACK;

On a single concurrent writer thread/connection:

BEGIN EXCLUSIVE;
UPDATE table SET col = z;
COMMIT;

In a WAL database, none of the threads will block (the BEGIN EXCLUSIVE will
not block the readers, and vice-versa), and the two SELECT's will always
get the same value?

Reply via email to