kikukawa's diary

都内で活動するシステムエンジニアが書いてます。 興味を持った技術やハマったポイント、自分用メモをつけてます。 最近はweb中心

postgresでテーブルをロックする

postgresでテーブルをロックする

pg_exec ($pg, "BEGIN WORK");
pg_exec ($pg, "lock table peke in share row exclusive mode");

$query = "select * from peke";
$result = pg_exec($pg, $query);

pg_exec ($pg, "COMMIT WORK");