リードコミッティド隔離レベル

25) Read Committed is the default isolation level in Postgres. When a transaction runs on this isolation level, a query sees only data committed before the query began and never sees either dirty data or concurrent transaction changes committed during query execution.

Postgres がデフォルトとする隔離レベルは リードコミッティド です.この隔離レベルで トランザクションが実行される場合,問い合わせが注目するのは 問い合わせが開始される直前までにコミットされたデータのみであり, ダーティ・データも,問い合わせ処理実行中に同時に実行される トランザクションがコミットした変更の関与も一切ありません.

26) If a row returned by a query while executing an UPDATE statement (or DELETE or SELECT FOR UPDATE) is being updated by a concurrent uncommitted transaction then the second transaction that tries to update this row will wait for the other transaction to commit or rollback. In the case of rollback, the waiting transaction can proceed to change the row. In the case of commit (and if the row still exists; i.e. was not deleted by the other transaction), the query will be re-executed for this row to check that new row version satisfies query search condition. If the new row version satisfies the query search condition then row will be updated (or deleted or marked for update).

今,UPDATE(または DELETESELECT FOR UPDATE )文を実行している間に返された行を, 同時に実行されている,コミットされていないトランザクションが更新しようと しているとします.するとそのトランザクションは元のトランザクションが コミット,またはロールバックされるまで待ち状態に入ります. ロールバックがあった場合,待ち状態にあるトランザクションは行に 対する更新を実行します.一方,コミットされた場合(かつ,この 行がまだ存在している,すなわち他のトランザクションによって削除 されていない場合),この行に対して問い合わせをもう一度実行し, 新しい「行バージョン」が問い合わせ条件を満たすかどうか確認します. そして新しい行バージョンが条件を満たしていれば,行が更新されます (あるいは削除されるか,更新予定の印がつきます).

27) Note that the results of execution of SELECT or INSERT (with a query) statements will not be affected by concurrent transactions.

SELECT , (問い合わせつき)INSERT 文の結果は 同時に実行されているトランザクションの影響を受けません.