LoginSignup
5
2

More than 5 years have passed since last update.

【メモ】PostgreSQLの明示的テーブルロック

Last updated at Posted at 2016-01-15

たまにタイトルのようなことをやる必要が出てくるので、忘れた時用にメモ

SELECTを許容する場合

BEGIN;

LOCK TABLE hoge IN EXCLUSIVE MODE;

SELECTも不可にする場合

BEGIN;

LOCK TABLE hoge IN ACCESS EXCLUSIVE MODE;

いずれにしてもcommitした時点でロックは解除される。

5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2