Skip to content

Instantly share code, notes, and snippets.

@yamaz
Created November 8, 2018 09:00
Show Gist options
  • Select an option

  • Save yamaz/41477510fececf59d1cc70d4b35ec893 to your computer and use it in GitHub Desktop.

Select an option

Save yamaz/41477510fececf59d1cc70d4b35ec893 to your computer and use it in GitHub Desktop.
-- Postgresqlで別プロセスでtransactionを共有する方法
-- Query A スナップショットexportしてsnapshot id取得する
BEGIN;
select pg_export_snapshot();
-- Query B 別セッションで参照
BEGIN TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SET TRANSACTION SNAPSHOT 'Aで取れたsnapshot id';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment